115 lines
2.9 KiB
JavaScript
115 lines
2.9 KiB
JavaScript
const path = require('path');
|
|
module.exports = {
|
|
lintOnSave: false,
|
|
productionSourceMap: false,
|
|
//多页面配置
|
|
pages: {
|
|
index: {
|
|
entry: 'examples/main.js',
|
|
template: 'public/index.html',
|
|
filename: 'index.html'
|
|
}
|
|
},
|
|
transpileDependencies: [/node_modules[/\\]dvcp-dv-ui/, /node_modules[/\\]dvcp-ui(.+)utils.js/],
|
|
chainWebpack: (config) => {
|
|
config.module
|
|
.rule('js')
|
|
.include.add(path.resolve(__dirname, 'packages'))
|
|
.add(path.resolve(__dirname, 'subPackages'))
|
|
.add(path.resolve(__dirname, 'core'))
|
|
.add(path.resolve(__dirname, 'project'))
|
|
.add(path.resolve(__dirname, 'oms'))
|
|
.add(path.resolve(__dirname, 'examples'))
|
|
.add(path.resolve(__dirname, 'node_modules/dvcp-dv-ui'))
|
|
.add(path.resolve(__dirname, 'node_modules/dvcp-ui'))
|
|
.end()
|
|
.use('babel')
|
|
.loader('babel-loader')
|
|
.tap((options) => options);
|
|
if (process.env.NODE_ENV == 'production') {
|
|
//生产环境,打包压缩js
|
|
config.plugin('uglifyjs-plugin').use('uglifyjs-webpack-plugin', [
|
|
{
|
|
include: /\/(packages|subPackages|core)/,
|
|
uglifyOptions: {
|
|
compress: {
|
|
drop_debugger: true, // console
|
|
drop_console: true,
|
|
pure_funcs: ['console.log'] // 移除console
|
|
},
|
|
warnings: false
|
|
},
|
|
sourceMap: false,
|
|
parallel: true
|
|
}
|
|
]);
|
|
}
|
|
},
|
|
devServer: {
|
|
host: '0.0.0.0', //主机地址
|
|
port: 8666, //端口号
|
|
open: true,
|
|
// devtool: 'cheap-module-eval-source-map',
|
|
proxy: {
|
|
//设置代理,可解决跨5
|
|
'/lan': {
|
|
target: 'http://192.168.1.87:9000',
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
//地址重写
|
|
'^/lan': '/'
|
|
}
|
|
},
|
|
'/saas': {
|
|
target: 'http://192.168.1.34:19898',
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
//地址重写
|
|
'^/saas': '/'
|
|
}
|
|
},
|
|
'/omsapi': {
|
|
target: 'http://192.168.1.87:19898',
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
//地址重写
|
|
'^/omsapi': '/'
|
|
}
|
|
},
|
|
'/ns': {
|
|
target: 'http://192.168.1.87:12525',
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
//地址重写
|
|
'^/ns': '/'
|
|
}
|
|
},
|
|
'/lns': {
|
|
target: 'http://localhost:12525',
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
//地址重写
|
|
'^/lns': '/'
|
|
}
|
|
},
|
|
'/xsjr': {
|
|
target: 'http://192.168.1.87:39896',
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
//地址重写
|
|
'^/xsjr': '/'
|
|
}
|
|
},
|
|
'/wg': {
|
|
target: 'http://192.168.1.34:10000',
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
//地址重写
|
|
'^/wg': '/'
|
|
}
|
|
}
|
|
},
|
|
disableHostCheck: true
|
|
}
|
|
};
|