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

Styles are getting duplicated in development mode #283

Closed
just-boris opened this issue Sep 20, 2018 · 4 comments
Closed

Styles are getting duplicated in development mode #283

just-boris opened this issue Sep 20, 2018 · 4 comments

Comments

@just-boris
Copy link

just-boris commented Sep 20, 2018

I have the following files:

common.css

.test {
    color: purple; /* just some styles to test */
}

component.css

@import './common.css';

styles.css

@import "./common.css";
@import "./component.css";

In the output bundle I have the following:

.test {
    color: purple;
}

.test {
    color: purple;
}

The references to common.css are not merged and the content is rendered twice. This happening only in mode: "development", and is actually caused by NamedModulesPlugin. Removing this module from config fixes the issue.

P.S. there is a repository, that you can checkout locally and reproduce the issue: https://github.com/just-boris/mini-css-extract-plugin-283

@xxzhiwei
Copy link

you can use webpack.optimization split the css

@alexander-akait
Copy link
Member

Or use minification plugin, it is out of scope this plugin

@TakCastel
Copy link

Why is this issue closed ? I encountered the same problem :'(

@alexander-akait
Copy link
Member

@TakCastel because removing duplicates is out of scope this plugin, if you will use browsers you will have same behavior, you can use https://github.com/webpack-contrib/css-minimizer-webpack-plugin to avoid this

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