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
When using a dynamic raw import (e.g. import(``./resource-${key}.json?raw``)), it is resolved properly in the dev mode, but fails when built for production:
In dev mode (npm run dev), the import is loaded successfully (main.ts).
In production mode (npm run build), the import fails:
index.50b9332a.js:1 Uncaught (in promise) Error: Unknown variable dynamic import: ./resource-a.json?raw
at index.50b9332a.js:1:858
at new Promise (<anonymous>)
at l (index.50b9332a.js:1:758)
at index.50b9332a.js:1:957
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.
Thanks for the quick update, @bluwy. I confirm - upgrading to 3.0.0-beta.2 fixed the problem (but broke storybook in the project, so not yet ready for us, unfortunately).
Describe the bug
When using a dynamic raw import (e.g.
import(``./resource-${key}.json?raw``)
), it is resolved properly in the dev mode, but fails when built for production:Similar resolved issues: #4252, #3222.
Reproducer
In dev mode (
npm run dev
), the import is loaded successfully (main.ts
).In production mode (
npm run build
), the import fails:Reproduction
https://github.com/orange-buffalo/reproducer-vite-dynamic-raw-import
System Info
System: OS: Linux 5.13 KDE neon 5.24 CPU: (8) x64 Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz Memory: 2.61 GB / 15.55 GB Container: Yes Shell: 5.0.17 - /bin/bash Binaries: Node: 16.15.0 - /usr/bin/node Yarn: 1.22.4 - /usr/bin/yarn npm: 8.5.5 - /usr/bin/npm Browsers: Brave Browser: 100.1.37.109 Firefox: 98.0.2 npmPackages: vite: ^2.9.9 => 2.9.12
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: