You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
this used to work fine up to 4.5.2 but in 4.5.3 the import shows as an empty object.
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 ?url not returning an URL was a bug. To fix your reproduction, remove ?url from the import URL.
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 ?? {};
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://github.com/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: