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
mini-css-extract-plugin & sideEffects incompatibility #118
Comments
A CSS File can't have any |
Well, ok but why the css file is not in the final bundle when using sideEffects? |
Where is |
Why is |
can confirm.
the style will be removed when setting sideEffects |
My use of mini-css-extract-plugin is basic. I just want a single css file. const { VueLoaderPlugin } = require('vue-loader')
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
var config = merge(baseConfig, {
output: { ... },
mode: 'production',
devtool: false,
optimization: { ... },
module: {
rules: [
{
test: /\.vue$/,
use: ["vue-loader"]
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: { minimize: { discardComments: { removeAll: true } } }
},
"postcss-loader",
"sass-loader"
]
},
{
test: /\.js$/,
include: [`${rootPath}/src`],
use: ["babel-loader"]
}
]
},
plugins: [
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: "static/css/[name].[hash:8].css"
})
]
})
} |
Hi, I also has the problem. |
"sideEffects": [ "*.css", "*.scss" ] |
I am still broken with use of If you are using Vue, what ended up fixing it for us was adding |
importing CSS is a side effect. Using import { ComponentA } from "./components.js"; {
"sideEffects": "*.css"
} // components.js
export { ComponentA } from "./componentA.js";
export { ComponentB } from "./componentB.js"; // componentA.js
import "./componentA.css";
export class ComponentA {} // componentB.js
import "./componentB.css";
export class ComponentB {} In this example |
@sokra Thanks for the explaination, I understand how |
Declaring sideEffects as true in your webpack config works as well.
|
Hey, for us, as soon as we use |
@willdurand in case you haven't seen it, here's an open issue for what you're describing: webpack/webpack#7094 |
Webpack 4.x
NodeJs 8.x/10.x
File generated by mini-css-extract-plugin is removed from the build because of sideEffects.
Confirmed with following values:
Refer to #93 (closed by the author but unfixed)
The text was updated successfully, but these errors were encountered: