Title: Circular dependency warnings in @internationalized/date during Vite/SvelteKit build
Description
While building a SvelteKit project with Vite, I see several "Circular dependency" warnings coming from the @internationalized/date package. The build completes successfully, but the warnings are noisy and may indicate module import cycles that could cause initialization/order issues in some bundlers or runtimes.
Environment
- Package:
@internationalized/date v3.12.0
- Repo: https://github.com/adobe/react-spectrum (package path: packages/@internationalized/date)
- Build tool: Vite (v7.x) used by SvelteKit
- OS: Windows (dev environment)
- Project: SvelteKit app using
@internationalized/date as a dependency (direct devDependency and used by bits-ui)
Relevant log excerpt (from npm run build)
Circular dependency: node_modules/@internationalized/date/dist/CalendarDate.mjs -> node_modules/@internationalized/date/dist/manipulation.mjs -> node_modules/@internationalized/date/dist/conversion.mjs -> node_modules/@internationalized/date/dist/CalendarDate.mjs
Circular dependency: node_modules/@internationalized/date/dist/manipulation.mjs -> node_modules/@internationalized/date/dist/conversion.mjs -> node_modules/@internationalized/date/dist/manipulation.mjs
Circular dependency: node_modules/@internationalized/date/dist/CalendarDate.mjs -> node_modules/@internationalized/date/dist/manipulation.mjs -> node_modules/@internationalized/date/dist/conversion.mjs -> node_modules/@internationalized/date/dist/GregorianCalendar.mjs -> node_modules/@internationalized/date/dist/CalendarDate.mjs
Circular dependency: node_modules/@internationalized/date/dist/conversion.mjs -> node_modules/@internationalized/date/dist/queries.mjs -> node_modules/@internationalized/date/dist/conversion.mjs
Circular dependency: node_modules/@internationalized/date/dist/CalendarDate.mjs -> node_modules/@internationalized/date/dist/string.mjs -> node_modules/@internationalized/date/dist/CalendarDate.mjs
Additional checks I ran
npm ls @internationalized/date shows a single installed version (3.12.0) — no duplicated versions in the application.
- The build completes with exit code 0 and the app appears to run fine when previewed, so this is currently a warning rather than a hard failure.
Why I think this is worth flagging
- Circular imports can result in
undefined exports depending on execution order in certain bundlers or at runtime (particularly for ES module initialization). They also make tree-shaking and optimizations less predictable.
- The warnings originate from the
dist/*.mjs modules (CalendarDate, manipulation, conversion, queries, string, GregorianCalendar) and appear during module graph analysis by Vite/Rollup.
Suggested direction / questions
- Could the code in
src be refactored to break these cycles? For example, extract shared helpers into a single utility module (no back-imports), or reorganize responsibilities to avoid mutual imports between CalendarDate, manipulation, conversion, and queries.
- Are these cycles intentional (e.g., documented) and benign for runtime, or would you consider a refactor to avoid them?
Reproduction
- In a SvelteKit project that depends on
@internationalized/date (v3.12.0), run:
npm install
npm run build
- Observe circular dependency warnings similar to the excerpt above in the build output.
If helpful, I can try to create a minimal reproduction repo or point to the full build logs from my project.
Thanks for any guidance — and happy to provide more info (node/vite versions, a small repro, or debug traces) if useful.
Title: Circular dependency warnings in @internationalized/date during Vite/SvelteKit build
Description
While building a SvelteKit project with Vite, I see several "Circular dependency" warnings coming from the
@internationalized/datepackage. The build completes successfully, but the warnings are noisy and may indicate module import cycles that could cause initialization/order issues in some bundlers or runtimes.Environment
@internationalized/datev3.12.0@internationalized/dateas a dependency (direct devDependency and used bybits-ui)Relevant log excerpt (from
npm run build)Circular dependency: node_modules/@internationalized/date/dist/CalendarDate.mjs -> node_modules/@internationalized/date/dist/manipulation.mjs -> node_modules/@internationalized/date/dist/conversion.mjs -> node_modules/@internationalized/date/dist/CalendarDate.mjs
Circular dependency: node_modules/@internationalized/date/dist/manipulation.mjs -> node_modules/@internationalized/date/dist/conversion.mjs -> node_modules/@internationalized/date/dist/manipulation.mjs
Circular dependency: node_modules/@internationalized/date/dist/CalendarDate.mjs -> node_modules/@internationalized/date/dist/manipulation.mjs -> node_modules/@internationalized/date/dist/conversion.mjs -> node_modules/@internationalized/date/dist/GregorianCalendar.mjs -> node_modules/@internationalized/date/dist/CalendarDate.mjs
Circular dependency: node_modules/@internationalized/date/dist/conversion.mjs -> node_modules/@internationalized/date/dist/queries.mjs -> node_modules/@internationalized/date/dist/conversion.mjs
Circular dependency: node_modules/@internationalized/date/dist/CalendarDate.mjs -> node_modules/@internationalized/date/dist/string.mjs -> node_modules/@internationalized/date/dist/CalendarDate.mjs
Additional checks I ran
npm ls @internationalized/dateshows a single installed version (3.12.0) — no duplicated versions in the application.Why I think this is worth flagging
undefinedexports depending on execution order in certain bundlers or at runtime (particularly for ES module initialization). They also make tree-shaking and optimizations less predictable.dist/*.mjsmodules (CalendarDate, manipulation, conversion, queries, string, GregorianCalendar) and appear during module graph analysis by Vite/Rollup.Suggested direction / questions
srcbe refactored to break these cycles? For example, extract shared helpers into a single utility module (no back-imports), or reorganize responsibilities to avoid mutual imports betweenCalendarDate,manipulation,conversion, andqueries.Reproduction
@internationalized/date(v3.12.0), run:If helpful, I can try to create a minimal reproduction repo or point to the full build logs from my project.
Thanks for any guidance — and happy to provide more info (node/vite versions, a small repro, or debug traces) if useful.