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
[plugin:vite:dynamic-import-vars] [plugin vite:dynamic-import-vars] main.js: invalid import "./demo-${n}.json`, { with: { type: 'json' } ". It cannot be statically analyzed. Variable dynamic imports must start with ./ and be limited to a specific directory. For example: import(`./foo/${bar}.js`).
Removing the second parameter fixes the error, but breaks the import when run in Node.js.
For JSON imports in particular, this should be supported (just ignore the param, or verify that it is in fact JSON).
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.
Describe the bug
[plugin:vite:dynamic-import-vars] [plugin vite:dynamic-import-vars] main.js: invalid import "./demo-${n}.json`, { with: { type: 'json' } ". It cannot be statically analyzed. Variable dynamic imports must start with ./ and be limited to a specific directory. For example: import(`./foo/${bar}.js`).
Removing the second parameter fixes the error, but breaks the
import
when run in Node.js.For JSON imports in particular, this should be supported (just ignore the param, or verify that it is in fact JSON).
Reproduction
https://stackblitz.com/edit/vitejs-vite-gud6b7?file=main.js
Steps to reproduce
Run
npm build
, or just load the demo pageSystem Info
https://stackblitz.com/edit/vitejs-vite-gud6b7?file=main.js
Used Package Manager
npm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: