|
@@ -1,3 +1,4 @@
|
|
|
+const packageName = require('./package.json').name
|
|
|
const webpack = require('webpack')
|
|
|
const { cdn, getProxyOfDomain, getProxyOfIp } = require('./config')
|
|
|
|
|
@@ -6,10 +7,10 @@ const external = {
|
|
|
'vue-router': 'VueRouter',
|
|
|
vuex: 'Vuex',
|
|
|
axios: 'axios',
|
|
|
- // echarts: 'echarts',
|
|
|
- jquery: '$',
|
|
|
lodash: '_',
|
|
|
- moment: 'moment'
|
|
|
+ echarts: 'echarts',
|
|
|
+ // moment: 'moment',
|
|
|
+ jquery: '$'
|
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
@@ -93,24 +94,14 @@ module.exports = {
|
|
|
chainWebpack: config => {
|
|
|
// single-spa
|
|
|
if (!process.env.VUE_APP_ALONE) {
|
|
|
-
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
// 生产环境配置
|
|
|
- // config.externals(external)
|
|
|
- // config.plugin('html').tap(args => {
|
|
|
- // // html中添加cdn
|
|
|
- // args[0].cdn = cdn
|
|
|
- // return args
|
|
|
- // })
|
|
|
- // config.output.filename('./js/[name].[chunkhash:8].js')
|
|
|
- config.output.filename = function (pathData) {
|
|
|
- return pathData.chunk.name === 'app' ? './js/[name].js' : './js/[name].[chunkhash:8].js'
|
|
|
- }
|
|
|
- config.output.chunkFilename('./js/[name].[chunkhash:8].js')
|
|
|
- // config.output.chunkFilename = function (pathData) {
|
|
|
- // console.log(JSON.stringify(pathData.chunk), '11')
|
|
|
- // return pathData.chunk.name === 'app' ? './js/[name].js' : './js/[name].[chunkhash:8].js';
|
|
|
- // };
|
|
|
+ config.externals(external)
|
|
|
+ config.plugin('html').tap(args => {
|
|
|
+ // html中添加cdn
|
|
|
+ args[0].cdn = cdn
|
|
|
+ return args
|
|
|
+ })
|
|
|
|
|
|
config.optimization.minimize(true)
|
|
|
.minimizer('terser')
|
|
@@ -123,7 +114,6 @@ module.exports = {
|
|
|
} else {
|
|
|
config.devServer.set('inline', false)
|
|
|
config.devServer.set('hot', true)
|
|
|
- config.output.filename('js/[name].js')
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -134,8 +124,12 @@ module.exports = {
|
|
|
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
|
|
|
}
|
|
|
},
|
|
|
- filenameHashing: false,
|
|
|
configureWebpack: {
|
|
|
+ output: {
|
|
|
+ library: 'bigMemberSubApp',
|
|
|
+ libraryTarget: 'umd',
|
|
|
+ jsonpFunction: `webpackJsonp_${packageName}`
|
|
|
+ },
|
|
|
plugins: [
|
|
|
new webpack.ProvidePlugin({
|
|
|
jQuery: 'jquery',
|