我的 webpack 输出中出现了这两个警告:
冲突警告:多个资产向相同的文件名 custom_styles.js.map 发出不同的内容
冲突警告:多个资产向相同的文件名 vendor_styles.js.map 发出不同的内容
子 mini-css-extract-plugin node_modules/css-loader/index.js!node_modules/sass-loader/lib/loader.js!src/styles/main.scss:入口点 mini-css-extract-plugin = * [. /node_modules/css-loader/index.js!./node_modules/sass-loader/lib/loader.js!./src/styles/main.scss] ./node_modules/css-loader!./node_modules/sass-loader /lib/loader.js!./src/styles/main.scss 9.22 KiB {mini-css-extract-plugin} [built] + 1 个隐藏模块子 mini-css-extract-plugin node_modules/css-loader/index. js!node_modules/sass-loader/lib/loader.js!src/styles/vendor.scss: 入口点 mini-css-extract-plugin = * [./node_modules/css-loader/index.js!./node_modules/sass -loader/lib/loader.js!./src/styles/vendor.scss] ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./src/styles/vendor.scss 1010 字节 {mini-css-extract-plugin} [内置] + 14 个隐藏模块
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const ROOT_PATH = path.resolve(__dirname);
// Compile all css into one css file
const ExtractPlugin = new MiniCssExtractPlugin({
filename: '[name].bundle.css'
});
const baseConfig = {
entry: {
custom_styles: './src/styles/main.scss',
vendor_styles: './src/styles/vendor.scss'
},
module: {
rules: [
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
// Compile scss into css files
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
}
]
},
output: {
path: path.resolve(ROOT_PATH, 'dist'),
publicPath: '/',
filename: '[name].bundle.js',
chunkFilename: '[id].bundle.js'
},
plugins: [ExtractPlugin]
};
module.exports = (env, args) => baseConfig