Skip to content

Commit

Permalink
fix: style loader
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 7, 2021
1 parent fcdb9df commit bed16c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion core/webpack-configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"raw-loader": "^4.0.2",
"sass": "^1.32.8",
"sass-loader": "^11.0.1",
"style-loader": "^2.0.0",
"typescript": "^4.0.5",
"url-loader": "^4.1.1",
"webpack": "^5.24.3"
Expand Down
23 changes: 11 additions & 12 deletions core/webpack-configs/src/react/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ export const react: PresetCallback = (options: BuildProps) => {
},
});
}
const result: Configuration = {
const result = {
plugins: [
new MiniCssExtractPlugin({
filename: options.cssFileName || defCssFileName,
}),
],
optimization: { minimizer: [] },
].filter(Boolean),
optimization: {
minimizer: [isProd && new CssMinimizerPlugin()].filter(Boolean),
},
performance: { hints: false },
module: {
rules: [
Expand Down Expand Up @@ -134,9 +136,11 @@ export const react: PresetCallback = (options: BuildProps) => {
// Creates `style` nodes from JS strings
{
loader: MiniCssExtractPlugin.loader,
options: customLoaderOptions(options, 'mini-css-extract-plugin', {
publicPath: '',
}),
options: customLoaderOptions(
options,
'mini-css-extract-plugin',
{},
),
},
{
// Translates CSS into CommonJS
Expand Down Expand Up @@ -202,11 +206,6 @@ export const react: PresetCallback = (options: BuildProps) => {
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
};
if (isProd) {
result.optimization = {
minimizer: [new CssMinimizerPlugin()],
};
}
} as Configuration;
return result;
};

0 comments on commit bed16c7

Please sign in to comment.