Skip to content

Unit script ignores configured postcss plugins #552

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

Closed
Spittal opened this issue Feb 27, 2017 · 2 comments
Closed

Unit script ignores configured postcss plugins #552

Spittal opened this issue Feb 27, 2017 · 2 comments

Comments

@Spittal
Copy link

Spittal commented Feb 27, 2017

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

@dimirc
Copy link

dimirc commented Mar 3, 2017

Maybe its related to an issue I'm also having when running unit too #563 (comment)

@LinusBorg
Copy link
Contributor

Closing in favor of #1021

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

3 participants