-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Issues with dynamic import of static JS file #18055
Comments
It worked for me with 4.5.2 and 4.5.3. It worked with 5.4.2 and 5.4.3 didn't work. Probably you wrote it wrong? The change was caused by #17915. The previous behavior that importing a JS file with const environmentConfig = await import(
- /* @vite-ignore */ `/config/${import.meta.env.MODE}.js?url`
+ /* @vite-ignore */ `/config/${import.meta.env.MODE}.js`
);
export const { value = 'This came from config.js' } = environmentConfig ?? {}; |
Apologies, it was a typo. Removing Apparently Vitest doesn't like importing from the public folder now though but that's a different issue. |
Describe the bug
Hi, I know this is probably an edge case but dynamic imports appear to be broken for me in v4.5.3.
I currently use a dynamic import to bring in configuration values based on the MODE value. The files are in the public folder and not bundled so that they can be modified post deployment.
Anyways, this used to work fine up to 4.5.2 but in 4.5.3 the import shows as an empty object.
Reproduction
https:/andokai/dynamic-import-bug
Steps to reproduce
After the usual
nom install
thennom run dev
, open the web app and you will see "This came from config.js" on the screen.Downgrade to an earlier version of Vote and you will see "This came from development.js".
System Info
Used Package Manager
npm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: