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

scss files from node modules not loading #102

Open
lastobelus opened this issue Oct 16, 2017 · 2 comments
Open

scss files from node modules not loading #102

lastobelus opened this issue Oct 16, 2017 · 2 comments

Comments

@lastobelus
Copy link

Scss files from installed node modules are not loading.

What I did:

// in index.js

import 'slick-carousel'
import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";

What happened:

Error in ./~/slick-carousel/slick/slick.scss
Module parse failed: /XXXX/node_modules/slick-carousel/slick/slick.scss Unexpected token (3:0)
You may need an appropriate loader to handle this file type.
| /* Slider */
|
| .slick-slider {
|     position: relative;
|     display: block;
 @ ./src/assets/js/index.js 9:0-42
 @ multi ./~/shopify-pipeline/lib/hot-client.js ./src/assets/js/index.js

Error in ./~/slick-carousel/slick/slick-theme.scss
Module parse failed: /XXXX/node_modules/slick-carousel/slick/slick-theme.scss Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type.
| @charset "UTF-8";
|
| // Default Variables
 @ ./src/assets/js/index.js 11:0-48
 @ multi ./~/shopify-pipeline/lib/hot-client.js ./src/assets/js/index.js

Inspecting the code, this would be because node_modules is in the excludes for the sass loader. What was the rationale behind this?

@lastobelus
Copy link
Author

font files from node_modules were also being excluded.

After removing exclude node_modules from the fonts fileloader config and from common_excludes, slick-carousel loads.

@nddery
Copy link
Contributor

nddery commented Oct 17, 2017

You should be able to include SCSS files from inside your other SCSS files. For example, from inside src/assets/sass/index.scss (which is imported from your entry point):

@import '~slick-carousel/slick/slick.scss';

Same goes for fonts, if you include them from your SCSS file, where you use them, Webpack should find and parse them correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants