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

Importing CSS from node_modules in SCSS does not work #860

Open
3 tasks done
zgoda opened this issue Sep 8, 2021 · 0 comments
Open
3 tasks done

Importing CSS from node_modules in SCSS does not work #860

zgoda opened this issue Sep 8, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@zgoda
Copy link

zgoda commented Sep 8, 2021

Describe the bug
In SCSS importing CSS file from installed package results in 404.

To Reproduce
Steps to reproduce the behavior in default starter:

  1. Rename public/style.css to public/style.scss, update public/index.html and install sass
  2. Install some css package, eg @csstools/normalize.css
  3. Add import in public/style.scss at the top: @import "../node_modules/@csstools/normalize.css/normalize.css";
  4. See error in terminal: 404 ./public/node_modules/@csstools/normalize.css/normalize.css - File not found

Expected behavior

  • Importing installed CSS files works exactly as with installed SCSS files.
  • Importing installed CSS files works exactly as with local CSS files.

Bug occurs with:

  • wmr or wmr start (development)
  • wmr build (production)
  • wmr serve

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser: n/a
  • Node Version: v14.17.6
  • WMR Version: 3.7.1

Additional context

When built, resulting CSS asset contains following line:

@import"../node_modules/@csstools/normalize.css/normalize.css";/*!

This of course fails also when served:

404 /node_modules/@csstools/normalize.css/normalize.css  - Not Found

Importing local CSS file works OK, importing installed SCSS also works fine. The path to installed CSS does not make much difference, it fails with relative path as in provided example and with simplified import by package name ( import '@csstools/normalize.css/normalize.css';).

@zgoda zgoda added the bug Something isn't working label Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant