Skip to content

error when using Css Modules composes with webpack 2 #382

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
JounQin opened this issue Dec 3, 2016 · 2 comments
Closed

error when using Css Modules composes with webpack 2 #382

JounQin opened this issue Dec 3, 2016 · 2 comments

Comments

@JounQin
Copy link
Contributor

JounQin commented Dec 3, 2016

I've looked through the issue #131, but it didn't work.


I'm using CssModules with css-loader, postcss-loader, stylus-loader, it throws an error:

Uncaught (in promise) TypeError: Cannot read property 'modal' of undefined

I've tried to change the importLoaders to be "2", but this error still occurs.

My total loader config string is:

style-loader!css-loader?-minimize&modules&camelCase&importLoaders=2&localIdentName=[name][local]_[hash:base64:5]&sourceMap!postcss-loader?sourceMap!stylus-loader?sourceMap

I looked through the compiled style code:

exports.locals = {
	"prompt": "prompt-modal__prompt___ySAyV " + __webpack_require__(699).locals["modal"] + "",
	"prompt": "prompt-modal__prompt___ySAyV " + __webpack_require__(699).locals["modal"] + "",
	"btn-prompt": "prompt-modal__btn-prompt___2k-dR",
	"btnPrompt": "prompt-modal__btn-prompt___2k-dR",
	"prompt-text": "prompt-modal__prompt-text___gQ1v5",
	"promptText": "prompt-modal__prompt-text___gQ1v5"
};

webpack_require(699) is an array as following:

@therealcisse
Copy link

I'm also getting this error but with sass-loader and using webpack 1.

@JounQin
Copy link
Contributor Author

JounQin commented Dec 5, 2016

I'm using css-loader in a Vue project, it seems to be an issue of vue-loader.

vuejs/vue-loader#501

I fix this problem by importing .styl file in script by myself, so that it won't be imported through vue-loader.

@JounQin JounQin closed this as completed Dec 5, 2016
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