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

Module build failed: TypeError: Cannot read property 'before' of undefined #78

Closed
brandondurham opened this issue Aug 24, 2015 · 6 comments

Comments

@brandondurham
Copy link

I'm using postcss in a Webpack project using the postcss-loader. I'm looking to store my global vars in a single index.css file and pull that in where needed. As soon as I add the postcss-import plugin and an import statement I get the following error:

ERROR in ./~/css-loader?modules&localIdentName=[name]--[local]_[hash:base64:5]!./~/postcss-loader!./src/js/website.com/components/Button/Button.css
Module build failed: TypeError: Cannot read property 'before' of undefined
    at Stringifier.raw (/Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/stringifier.js:121:30)
    at Stringifier.body (/Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/stringifier.js:93:31)
    at Stringifier.root (/Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/stringifier.js:37:14)
    at Stringifier.stringify (/Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/stringifier.js:33:24)
    at _default.stringify (/Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/stringify.js:14:9)
    at _default.generateString (/Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/map-generator.js:231:14)
    at _default.generateMap (/Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/map-generator.js:189:14)
    at _default.generate (/Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/map-generator.js:271:25)
    at LazyResult.stringify (/Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:221:24)
    at /Users/username/Sites/website/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:158:27
    at lib$es6$promise$$internal$$tryCatch (/Users/username/Sites/website/node_modules/autoprefixer-core/node_modules/postcss/node_modules/es6-promise/dist/es6-promise.js:331:16)
    at lib$es6$promise$$internal$$invokeCallback (/Users/username/Sites/website/node_modules/autoprefixer-core/node_modules/postcss/node_modules/es6-promise/dist/es6-promise.js:343:17)
    at /Users/username/Sites/website/node_modules/autoprefixer-core/node_modules/postcss/node_modules/es6-promise/dist/es6-promise.js:891:13
    at Object.lib$es6$promise$asap$$flush [as _onImmediate] (/Users/username/Sites/website/node_modules/autoprefixer-core/node_modules/postcss/node_modules/es6-promise/dist/es6-promise.js:125:9)
    at processImmediate [as _immediateCallback] (timers.js:345:15)
 @ ./src/js/website.com/components/Button/Button.css 4:14-198

This is my loader:

{
    test: /\.(css)$/,
    loader: 'style-loader!css-loader?modules&localIdentName=[name]--[local]_[hash:base64:5]!postcss-loader'
}

… and the postcss config:

postcss: function () {
    return [
        require('postcss-import'),
        require('postcss-custom-properties'),
        require('postcss-mixins')
    ];
}

Any ideas?

@ai
Copy link
Member

ai commented Aug 24, 2015

It is because this PR still not accepted #76

@brandondurham
Copy link
Author

Ahh, damn. Thanks for the super quick response. I'll upgrade locally until it's approved.

@MoOx
Copy link
Contributor

MoOx commented Aug 25, 2015

Dup of #75

@MoOx MoOx closed this as completed Aug 25, 2015
@MoOx
Copy link
Contributor

MoOx commented Aug 25, 2015

@ai you can see that the postcssVersion thing is not helping here :/

@cbrwizard
Copy link

I am also getting this error now, using latest version (I guess)

@MoOx
Copy link
Contributor

MoOx commented Nov 12, 2015

Please provide full trace of the error and your exact postcss and plugin versions.

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

4 participants