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

New webpack mini-css-extract-plugin didn't work with imported styles because of wrong sideEffects flag value #2454

Closed
iAdramelk opened this issue May 3, 2018 · 1 comment

Comments

@iAdramelk
Copy link

Bug report

I'm trying to migrate to webpack@4. Webpack after 4.x.x didn't support extract-text-webpack-plugin and developers recommends to use mini-css-extract-plugin. It works fine but didn't imports following files:

import '@blueprintjs/core/lib/css/blueprint.css';
import '@blueprintjs/icons/lib/css/blueprint-icons.css';

While investigatin source of this problem I found following issue webpack-contrib/mini-css-extract-plugin#102 and following comment in it: webpack-contrib/mini-css-extract-plugin#102 (comment)

It says:

react-live has sideEffects: false in it's package.json. This flags all modules as side effect free. But this is incorrect as css files have a side effect (adding styles to the DOM). As you are not using any export of the imported css webpack flags the css file as unneeded and doesn't include it in the css bundle.

Instead the package.json should do sideEffects: [ "*.css" ].

@blueprint packages also use sideEffects: false flag in their package.json files, so I tried to replace it with sideEffects: [ "*.css" ] and it fixed this issue for me.

Can we update it in repo?

@giladgray
Copy link
Contributor

yes we should definitely update this in the package.json files! this same issue just surfaced internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants