-
Notifications
You must be signed in to change notification settings - Fork 131
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
[Bug]: can't dynamic import svg from template string variable with @rsbuild/plugin-svgr
#1766
Comments
This may be a bug of the Rspack rule matching, I will transfer this issue to the Rspack repo for follow up. |
The SVGR rule uses We'll try to figure out a way to match this. |
Related issue: webpack/webpack#9309 |
In webpack, i can specifying the loader to bypass it ( example ): async function load() {
const name = 'react'
// not work
// const A1 = await import(`./assets/${name}.svg`)
// console.log(A1)
// work, specify to use the svgr loader
const A2 = await import(`@svgr/webpack!./assets/${name}.svg`)
console.log(A2)
}
load() I tried installing |
Rsbuild supports the const icon1 = await import(`./assets/${name}.svg?react`); |
I get the error |
Can you provide a reproduction repo for this? |
This might be a bug of Rspack:
const icon = await import(`./${name}.svg?react`)
const icon = await import(`./assets/${name}.svg?react`) |
@LingyuCoder can you take a look? ❤️ |
There is a bug in context module dependency code generation, I will try to fix it |
Had been fixed, you can try rspack 0.5.9 |
Nice 👍 I will release a new Rsbuild version today, which is based on Rspack v0.5.9 |
Released |
Version
Details
Reproduce link
https://github.com/zhylmzr/rsbuild-demo
Reproduce Steps
clone the git repository and
bun i && bun dev
The text was updated successfully, but these errors were encountered: