Skip to content

feat(config): warn on named imports from JSON modules - #23378

Open
btea wants to merge 4 commits into
vitejs:mainfrom
btea:refactor/named-import-of-the-version-field
Open

feat(config): warn on named imports from JSON modules#23378
btea wants to merge 4 commits into
vitejs:mainfrom
btea:refactor/named-import-of-the-version-field

Conversation

@btea

@btea btea commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Only the version field in package.json is used, so we can import it directly.

@sapphi-red

Copy link
Copy Markdown
Member

Technically this isn't correct as no named export exist per spec.
https://github.com/tc39/proposal-json-modules#why-dont-json-modules-support-named-exports

@btea

btea commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the detailed explanation; I only just learned about this standard. It seems the current configLoader method is causing it to parse successfully.

Perhaps we should add syntax validation warnings to nativeConfigCompat.ts to address this situation.

@sapphi-red

Copy link
Copy Markdown
Member

Adding a compat warning sounds nice to me 👍

@btea

btea commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Okay, I'll adjust it directly in this PR.

@btea btea changed the title refactor: use a named import of the version field feat(config): warn on named imports from JSON modules Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants