Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

css-modules @import from node_modules issue/question #701

Closed
chrisblossom opened this issue Apr 9, 2016 · 2 comments
Closed

css-modules @import from node_modules issue/question #701

chrisblossom opened this issue Apr 9, 2016 · 2 comments

Comments

@chrisblossom
Copy link

@davezuko, your repo was directly linked in css-modules/css-modules#65.

I am trying to get css-modules to

// global.scss
:global {
  @import "~normalize.css/normalize.css"
}

results in:

Module build failed: ModuleNotFoundError: Module not found: Error: Cannot resolve module '~normalize.css/normalize.css' in /Users/chris/github/app/src/components

styles/core.scss shows you are importing locally managed version. Did you have similar issues using the npm version?

This seems to be the suggested way to import css from node_modules. webpack-contrib/css-loader#12 SurviveJS's Webpack loading styles section

@gajus I would love to see if you had any input on this as well.

Thank you for your time.

//cc @bebraw

@sohkai
Copy link

sohkai commented Apr 25, 2016

@chrisblossom Your problem is probably that you're specifying the .css extension (see this PR for libsass). What if you drop it and just try to @import "~normalize.css/normalize"?

If that doesn't work, it might also be because you need a modules definition your webpack config's resolve option.

@dvdzkwsk
Copy link
Owner

dvdzkwsk commented Apr 25, 2016

Just shipped a change doing exactly what @sohkai recommends. Let me know if you run into any trouble.

Commit: 4c58d9f

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

No branches or pull requests

3 participants