/**
* webpack.config.js
* 新增concat部分
*
*/
//react,項(xiàng)目中所有scss文件均可使用變量和方法,無(wú)需再次單獨(dú)引入
{
test: sassRegex,
exclude: sassModuleRegex,
use: getStyleLoaders(
{
importLoaders: 3,
sourceMap: isEnvProduction && shouldUseSourceMap,
},
'sass-loader'
).concat({
loader:'sass-resources-loader',
optionss:{
resources:[
//這里按照實(shí)際文件路徑填寫
path.resolve(__dirname,'./../src/styles/main.scss')
]
}
}),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github.com/webpack/webpack/issues/6571
sideEffects: true,
},