Skip to content
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

Vite V6 can't resolve alias if css transformer is lightningcss #18806

Closed
7 tasks done
kovalchukq opened this issue Nov 27, 2024 · 0 comments · Fixed by #18819
Closed
7 tasks done

Vite V6 can't resolve alias if css transformer is lightningcss #18806

kovalchukq opened this issue Nov 27, 2024 · 0 comments · Fixed by #18819
Labels
feat: css p2-edge-case Bug, but has workaround or limited in scope (priority) regression The issue only appears after a new release

Comments

@kovalchukq
Copy link

kovalchukq commented Nov 27, 2024

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

Windows

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

@sapphi-red sapphi-red added feat: css p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release labels Nov 28, 2024
@sapphi-red sapphi-red added p2-edge-case Bug, but has workaround or limited in scope (priority) and removed p3-minor-bug An edge case that only affects very specific usage (priority) labels Nov 28, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: css p2-edge-case Bug, but has workaround or limited in scope (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants