Skip to content

Disable local scoping for external libraries (node_modules) #75

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
bogdansoare opened this issue Jun 11, 2015 · 2 comments
Closed

Disable local scoping for external libraries (node_modules) #75

bogdansoare opened this issue Jun 11, 2015 · 2 comments

Comments

@bogdansoare
Copy link

First I want to say local scope enabled by defalut is amazing. (css-loader?module)

But I'm having trouble with third party libs when I import their css from node_modules. I don't want that css locally scoped, I want their css to be global.

For example when I try to use React Toggle by importing @import "../../node_modules/react-toggle/style.css"; in my general shared css, each class gets scoped with the localIdentName.

Any solutions? Thank you.

@zxcabs
Copy link

zxcabs commented Jun 12, 2015

You can add node_modules in exclude options for loader.

@bogdansoare
Copy link
Author

@zxcabs Thanks for the suggestion.

I ended up using 2 different loaders, one for the scoped components and another for the general shared css.

{ test: /\.css$/, loader: ExtractTextPlugin.extract('css-loader?module&localIdentName=[name]__[local]!cssnext-loader'), include: /src\/components/ },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('css-loader!cssnext-loader'), exclude: /src\/components/ },

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