Vite V6 can't resolve alias if css transformer is lightningcss #18806
Labels
feat: css
p2-edge-case
Bug, but has workaround or limited in scope (priority)
regression
The issue only appears after a new release
Describe the bug
I am doing:
I am using Vite v6.0.1 in my project with the lightningcss CSS transformer enabled. My configuration includes custom aliases in vite.config.ts, such as
@assets
pointing to the assets folder. In my CSS files, I reference assets using this alias, like this:background-image: url("@assets/vue.svg");
What I expect is:
The alias
@assets
should resolve to the correct path.What actually happens is:
When the lightningcss transformer is enabled, Vite fails to resolve the alias
@assets
in CSS files and Vue style files.Reproduction
https://stackblitz.com/edit/vitejs-vite-c1vaah?file=src%2Fstyle.css
Steps to reproduce
Run
npm run dev
System Info
Used Package Manager
npm
Logs
[plugin:vite:css-analysis] ENOENT: no such file or directory, open '@assets/vue.svg'
/home/projects/vitejs-vite-c1vaah/src/style.css
Validations
The text was updated successfully, but these errors were encountered: