Closed
Description
I've configured and am using postcss-smart-import
to help with my CSS imports. This works beautifully with both the dev
and build
scripts defined in the package.json
however when I attempt to run the unit
script it fails and complains about modules not being resolved.
The error is several iterations of this:
ERROR in ./~/css-loader?{"minimize":false}!./src/shared/style-base/index.css
Module not found: Error: Can't resolve './colors' in '/Users/jamie/web/terraforming-mars-tools/src/shared/style-base'
@ ./~/css-loader?{"minimize":false}!./src/shared/style-base/index.css 3:10-94
@ ./src/shared/style-base/index.css
@ ./src ^\.\/(?!main(\.js)?$)
@ ./test/unit/index.js
I can work around this by using relative paths. For example if I wanted to include normalize.css
I would have to use the following code:
@import url('../../../node_modules/normalize.css/normalize.css');
I just updated to the new .postcssrc
syntax, and here is my configuration:
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
// to edit target browsers: use "browserlist" field in package.json
"postcss-smart-import": {
"path": ["src"]
},
"postcss-cssnext": {},
}
}
Thanks for reading and let me know if I can provide more details.
The app I'm working on is open source you can see it here: https://gitlab.com/Spittal/terraforming-mars-tools/tree/master
Metadata
Metadata
Assignees
Labels
No labels