-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
No loader is configured for ".svg" files with dynamic import #15129
Comments
This may be related to the way // Replaced source code
function test(name) {
const path = `./assets/${name}.svg`;
import(path)
}
// Previous source code
function test(name) {
import(`./assets/${name}.svg`)
} |
It seems that |
Importing with // This will not be bundled
const path = './data/' + kind + '.json'
const json2 = await import(path) The two build tools conflict when dealing with this. |
I added a workaround for HTML-like files (e.g. vite/packages/vite/src/node/optimizer/scan.ts Lines 552 to 570 in 0654d1b
|
Describe the bug
Static import for
.svg
is OK but if we just define a function in which dynamic import.svg
, then vite will throw an errorNo loader is configured for
.This happens since vite@5
Reproduction
https://stackblitz.com/edit/vitejs-vite-evuxjc?file=main.js
Steps to reproduce
npm run dev
System Info
npmPackages: vite: ^5.0.0 => 5.0.2
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: