Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
c5a05ecd22
@ -1,5 +1,5 @@
|
||||
# just a flag
|
||||
NODE_ENV = 'Local'
|
||||
NODE_ENV = 'production'
|
||||
VUE_APP_PRO = 'local'
|
||||
|
||||
# base api
|
||||
|
@ -1,5 +1,5 @@
|
||||
# just a flag
|
||||
NODE_ENV = 'test'
|
||||
NODE_ENV = 'production'
|
||||
|
||||
# base api
|
||||
VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud'
|
||||
|
@ -9,13 +9,6 @@ const webpack = require('webpack');
|
||||
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
// http://127.0.0.1:8888/ 分析打包模块可视化
|
||||
|
||||
// const CompressionPlugin = require('compression-webpack-plugin');
|
||||
// const productionGzipExtensions = ['js', 'css'];
|
||||
// const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
// let { version } = require('./package.json');
|
||||
// version = version.replace(/\./g, '_');
|
||||
|
||||
const name = defaultSettings.title; // page title
|
||||
const port = 9527; // dev port
|
||||
|
||||
@ -32,7 +25,6 @@ module.exports = {
|
||||
outputDir: 'dist',
|
||||
assetsDir: 'static', // 相对于outputDir的静态资源(js、css、img、fonts)目录
|
||||
lintOnSave: false,
|
||||
// filenameHashing: true,
|
||||
productionSourceMap: false, // 项目打包后是否压缩
|
||||
devServer: {
|
||||
port: port,
|
||||
@ -64,44 +56,35 @@ module.exports = {
|
||||
// },
|
||||
// parallel: require('os').cpus().length > 1, // 是否为 Babel 或 TypeScript 使用 thread-loader。该选项在系统的 CPU 有多于一个内核时自动启用,仅作用于生产构建。
|
||||
configureWebpack: config => {
|
||||
// if (process.env.NODE_ENV === 'production') {
|
||||
// // 为生产环境修改配置...
|
||||
// config.mode = 'production';
|
||||
|
||||
// Object.assign(config, {
|
||||
// output:{
|
||||
// ...config.output,
|
||||
// filename: `static/js/[name].[chunkhash].${version}.js`,
|
||||
// chunkFilename: `static/js/[name].[chunkhash].${version}.js`
|
||||
// }
|
||||
// });
|
||||
// // config.plugins = [
|
||||
// // ...config.plugins,
|
||||
// // new CompressionPlugin({
|
||||
// // test:/\.js$|\.html$|.\css/, // 匹配文件名
|
||||
// // threshold: 10240, // 对超过10k的数据压缩
|
||||
// // deleteOriginalAssets: false // 不删除源文件
|
||||
// // })
|
||||
// // ];
|
||||
|
||||
// } else {
|
||||
// // 为开发环境修改配置...
|
||||
// config.mode = 'development';
|
||||
// }
|
||||
config.name = name;
|
||||
config.resolve = {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
// modules: [path.resolve(__dirname, './node_modules')],
|
||||
alias: { // 添加别名
|
||||
'@': path.resolve('src')
|
||||
}
|
||||
};
|
||||
const appTarget = process.env.NODE_ENV === 'Local' || process.env.VUE_APP_PRO === 'local' ? 'HYD' : 'Common';
|
||||
const appTarget = process.env.VUE_APP_PRO == 'local' ? 'HYD' : 'Common'; // 其他环境变量 区分配置
|
||||
config.plugins.push(new webpack.NormalModuleReplacementPlugin(/(.*)_APP_TARGET(\.*)/,
|
||||
function (resourse) {
|
||||
resourse.request = resourse.request.replace(/APP_TARGET/, `${appTarget}`);
|
||||
})
|
||||
);
|
||||
if (process.env.NODE_ENV != 'development') {
|
||||
config.mode = 'production';
|
||||
|
||||
Object.assign(config, {
|
||||
output:{
|
||||
...config.output,
|
||||
filename: `static/js/[name].[hash:6].js`,
|
||||
chunkFilename: `static/js/[name].[chunkhash:6].js`
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 为开发环境修改配置...
|
||||
config.mode = 'development';
|
||||
config.name = name;
|
||||
}
|
||||
|
||||
config.resolve = {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
alias: { // 添加别名
|
||||
'@': path.resolve('src')
|
||||
}
|
||||
};
|
||||
|
||||
config.plugins.push(new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, './static'),
|
||||
@ -110,15 +93,7 @@ module.exports = {
|
||||
}
|
||||
]));
|
||||
// config.plugins.push(new BundleAnalyzerPlugin());
|
||||
const externalsConfig = {
|
||||
// 'vue': 'Vue',
|
||||
// 'vuex': 'Vuex',
|
||||
// 'vue-router': 'VueRouter',
|
||||
// 'nprogress': 'NProgress',
|
||||
// 'echarts': 'echarts',
|
||||
// 'element-ui': 'ELEMENT'
|
||||
};
|
||||
config.externals = process.env.NODE_ENV === 'Local' || process.env.VUE_APP_PRO === 'local' ? {} : externalsConfig; // 配置CDN使用
|
||||
config.externals = {}; // 配置CDN使用
|
||||
},
|
||||
// webpack配置
|
||||
chainWebpack(config) {
|
||||
@ -184,39 +159,32 @@ module.exports = {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
name(module) {
|
||||
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
|
||||
return `chunk.${packageName.replace('@', '')}`;
|
||||
return `split-chunk.${packageName.replace('@', '')}`;
|
||||
},
|
||||
priority: 10, // 缓存组优先级 数字越⼤大,优先级越⾼高
|
||||
reuseExistingChunk: true // 如果当前代码块包含的模块已经有了,就不在产生一个新的代码块
|
||||
},
|
||||
jlmap: {
|
||||
name: 'jlmap',
|
||||
name: 'split-jlmap',
|
||||
test: path.resolve(__dirname, './src/jmap'),
|
||||
priority: 8,
|
||||
minChunks: 1,
|
||||
reuseExistingChunk: true
|
||||
},
|
||||
jmapNew: {
|
||||
name: 'jmapNew',
|
||||
name: 'split-jmapNew',
|
||||
test: path.resolve(__dirname, './src/jmapNew'),
|
||||
priority: 9,
|
||||
minChunks: 1,
|
||||
reuseExistingChunk: true
|
||||
},
|
||||
jlmap3d: {
|
||||
name: 'jlmap3d',
|
||||
name: 'split-jlmap3d',
|
||||
test: path.resolve(__dirname, './src/jlmap3d'),
|
||||
priority: 7,
|
||||
minChunks: 1,
|
||||
reuseExistingChunk: true
|
||||
}
|
||||
// ibp: {
|
||||
// name: 'ibp',
|
||||
// test: path.resolve(__dirname, './src/ibp'),
|
||||
// priority: -10,
|
||||
// minChunks: 1,
|
||||
// reuseExistingChunk: true
|
||||
// }
|
||||
}
|
||||
});
|
||||
config.optimization.runtimeChunk('single');
|
||||
|
Loading…
Reference in New Issue
Block a user