-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic Import of JSON File skips import of Keys with Fullstop/Dot (.) #11359
Comments
This is not a bug. export const foo.bar = '' // this is not a valid js syntax If we use "Arbitrary module namespace identifier names" that landed in ES2022, we could support this: const foo_bar = ''
export { foo_bar as 'foo.bar' } But this is not supported by rollup yet (rollup/rollup#4322). |
I am facing a similar issue. I have a JSON file with translations. Some keys contain spaces. For example: How can I fix it? |
Ha, I just fixed it. For future reference: Does not work:
Works:
|
Hey, just checking in to ask what the progress is on fixing this? We just migrated to Vite and this is causing a big regression in the way we translate our app. We've implemented a workaround but it's less than pretty and would like to be able to just dynamically import the JSON files directly. |
In the last meeting we had discussed that we could support a new |
Describe the bug
When dynamiclly importing a JSON file that contains keys with fullstops in it (i.e.
foo.bar
), these key/value pairs are not imported but skipped:de.json:
Import:
Output:
It can be seen, that "foo.bar" only exists under "default":
Expected Output (previously working with Webpack Dynamic Import):
"foo.bar" exists at top level:
Reproduction
https://stackblitz.com/edit/vitejs-vite-3yrpdy?file=main.js
Steps to reproduce
No response
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: