Skip to content

Commit 8aeffd4

Browse files
committed
【update】 sass打包不压缩; review by luox
1 parent a6082bc commit 8aeffd4

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

config/webpack.base.config.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const resolve = require('resolve');
55
const webpack = require('webpack');
66
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
77
const ESLintPlugin = require('eslint-webpack-plugin');
8-
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
98
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
109
const ForkTsCheckerWebpackPlugin =
1110
process.env.TSC_COMPILE_ON_ERROR === 'true'
@@ -30,7 +29,7 @@ const hasJsxRuntime = (() => {
3029

3130
module.exports = function(isEnvProduction) {
3231
const isEnvDevelopment = !isEnvProduction;
33-
const getStyleLoaders = (cssOptions, preProcessor) => {
32+
const getStyleLoaders = (cssOptions, preProcessor, preProcessorOptions) => {
3433
const loaders = [
3534
isEnvDevelopment && require.resolve('style-loader'),
3635
isEnvProduction && {
@@ -81,7 +80,8 @@ module.exports = function(isEnvProduction) {
8180
{
8281
loader: require.resolve(preProcessor),
8382
options: {
84-
sourceMap: true
83+
sourceMap: true,
84+
...preProcessorOptions
8585
}
8686
}
8787
);
@@ -178,7 +178,10 @@ module.exports = function(isEnvProduction) {
178178
exclude: /\.module\.css$/,
179179
use: getStyleLoaders({
180180
importLoaders: 1,
181-
sourceMap: true
181+
sourceMap: true,
182+
modules: {
183+
mode: 'icss',
184+
}
182185
}),
183186
sideEffects: true
184187
},
@@ -188,9 +191,17 @@ module.exports = function(isEnvProduction) {
188191
use: getStyleLoaders(
189192
{
190193
importLoaders: 3,
191-
sourceMap: true
194+
sourceMap: true,
195+
modules: {
196+
mode: 'icss',
197+
}
192198
},
193-
'sass-loader'
199+
'sass-loader',
200+
{
201+
sassOptions: {
202+
outputStyle: 'expanded'
203+
}
204+
}
194205
),
195206
sideEffects: true
196207
},

0 commit comments

Comments
 (0)