可视化平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.3 KiB

var path = require("path");
var webpack = require("webpack");
const $config = require("./config.js")
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const root = path.resolve($config.modules_root, $config.modules_dir);
module.exports = {
mode: "production",
// 你想要打包的模块的数组
entry: $config.modules,
module: {
rules: [{
test: /\.css$/,
use: [{
loader: MiniCssExtractPlugin.loader,
options: {
esModule: true,
},
},
'css-loader',
]
}]
},
output: {
path: root, // 打包后文件输出的位置
filename: '[name].[hash:8].dll.js',
library: '[name]_library'
// vendor.dll.js中暴露出的全局变量名。
// 主要是给DllPlugin中的name使用,
// 故这里需要和webpack.DllPlugin中的`name: '[name]_library',`保持一致。
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// all options are optional
filename: '[name].[hash:8].dll.css',
chunkFilename: '[id].css',
ignoreOrder: false, // Enable to remove warnings about conflicting order
}),
new webpack.DllPlugin({
path: path.join(root, '[name]-manifest.json'),
name: '[name]_library',
context: process.cwd()
}),
]
};