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

Raw css import from node_modules fails #5724

Closed
7 tasks done
gluck opened this issue Nov 17, 2021 · 0 comments · Fixed by #5796
Closed
7 tasks done

Raw css import from node_modules fails #5724

gluck opened this issue Nov 17, 2021 · 0 comments · Fixed by #5796

Comments

@gluck
Copy link
Contributor

gluck commented Nov 17, 2021

Describe the bug

As the title says:

// This works fine
// import raw from './style.css?raw';

// This works too
// import raw from '@fontsource/inter/package.json?raw';

// This fails
import raw from '@fontsource/inter/index.css?raw';

I believe that's because vite:css plugin tries to transform code irrespective of if it's a special query (probably affects ?url as well ?). I can submit a PR to skip transform in vite:css if it's a special query (or just on ?raw).
(in raw case, vite:css fails parsing the code as it's JS export default "..." and not CSS)

Reproduction

  • go to vite.new
  • add @fontsource/inter dependency
  • copy above snippet inside main.js

Result: https://stackblitz.com/edit/vite-59yl1g

System Info

Stackblitz

Used Package Manager

npm

Logs

No response

Validations

mvolfik added a commit to mvolfik/gcs-gallery that referenced this issue Feb 14, 2022
Currently doesn't build correctly due to vitejs/vite#5724
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants