brain-vue-cli
Version:
A command line tool used to run projects
44 lines • 1.67 kB
text/typescript
import WebpackDllManifest from '../libs/settings/WebpackDllManifest';
import EConfig from '../libs/settings/EConfig';
var path = require('path');
var webpack = require('webpack');
const {webpack:{dllConfig:{vendors}}} = EConfig.getInstance();
const webpackDllManifest = WebpackDllManifest.getInstance();
const distPath = webpackDllManifest.distPath;
const isVendorExist = vendors && vendors.length;
if (isVendorExist) {
// const distFileName = webpackDllManifest.getVendorsHash();
module.exports = {
entry: {
vendors
},
output: {
path: distPath,
//filename: `${distFileName}.js`, //打包文件的名字
filename: `vendor.dll.js`, //打包文件的名字
library: '[name]_library' //可选 暴露出的全局变量名
// vendor.dll.js中暴露出的全局变量名。
// 主要是给DllPlugin中的name使用,
// 故这里需要和webpack.DllPlugin中的`name: '[name]_library',`保持一致。
},
plugins: [
new webpack.DllPlugin({
//path: path.join(distPath, `${distFileName}.json`),
path: path.join(distPath, `vendor.dll.json`),
name: '[name]_library'
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
drop_console:true,
drop_debugger:true
},
output:{
// 去掉注释内容
comments: false,
},
sourceMap: false
})
]
};
}