|
@@ -1,6 +1,27 @@
|
|
const packageName = require('./package.json').name
|
|
const packageName = require('./package.json').name
|
|
const webpack = require('webpack')
|
|
const webpack = require('webpack')
|
|
|
|
|
|
|
|
+const cdn = {
|
|
|
|
+ css: [
|
|
|
|
+ // '//unpkg.com/element-ui@2.10.1/lib/theme-chalk/index.css'
|
|
|
|
+ ],
|
|
|
|
+ js: [
|
|
|
|
+ '//cdn-common.jianyu360.com/cdn/lib/vue/2.6.11/vue.min.js',
|
|
|
|
+ '//cdn-common.jianyu360.com/cdn/lib/vue-router/3.5.4/vue-router.min.js',
|
|
|
|
+ '//cdn-common.jianyu360.com/cdn/lib/vuex/3.4.0/vuex.min.js',
|
|
|
|
+ '//cdn-common.jianyu360.com/cdn/lib/axios/0.19.2/axios.min.js',
|
|
|
|
+ '//cdn-common.jianyu360.com/cdn/lib/lodash/4.17.21/lodash.min.js',
|
|
|
|
+ ]
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const external = {
|
|
|
|
+ vue: 'Vue',
|
|
|
|
+ 'vue-router': 'VueRouter',
|
|
|
|
+ vuex: 'Vuex',
|
|
|
|
+ axios: 'axios',
|
|
|
|
+ lodash: '_',
|
|
|
|
+}
|
|
|
|
+
|
|
module.exports = {
|
|
module.exports = {
|
|
parallel: false,
|
|
parallel: false,
|
|
productionSourceMap: false,
|
|
productionSourceMap: false,
|
|
@@ -12,6 +33,10 @@ module.exports = {
|
|
port: '8080',
|
|
port: '8080',
|
|
disableHostCheck: true,
|
|
disableHostCheck: true,
|
|
proxy: {
|
|
proxy: {
|
|
|
|
+ '^/common-module': {
|
|
|
|
+ target: 'https://jybx2-webtest.jydev.jianyu360.com/',
|
|
|
|
+ changeOrigin: true,
|
|
|
|
+ },
|
|
'^/jyintegral': {
|
|
'^/jyintegral': {
|
|
target: 'https://jybx2-webtest.jydev.jianyu360.com/',
|
|
target: 'https://jybx2-webtest.jydev.jianyu360.com/',
|
|
changeOrigin: true,
|
|
changeOrigin: true,
|
|
@@ -33,6 +58,18 @@ module.exports = {
|
|
pathRewrite: {
|
|
pathRewrite: {
|
|
'^/jypay': '/jypay'
|
|
'^/jypay': '/jypay'
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ '^/jyapi': {
|
|
|
|
+ target: 'https://jybx2-webtest.jydev.jianyu360.com',
|
|
|
|
+ changeOrigin: true
|
|
|
|
+ },
|
|
|
|
+ '^/jyintegral': {
|
|
|
|
+ target: 'https://jybx2-webtest.jydev.jianyu360.com',
|
|
|
|
+ changeOrigin: true
|
|
|
|
+ },
|
|
|
|
+ '^/jyActivity': {
|
|
|
|
+ target: 'https://jybx2-webtest.jydev.jianyu360.com',
|
|
|
|
+ changeOrigin: true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -44,7 +81,24 @@ module.exports = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
chainWebpack: config => {
|
|
chainWebpack: config => {
|
|
- 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.optimization.minimize(true)
|
|
|
|
+ .minimizer('terser')
|
|
|
|
+ // .tap(args => {
|
|
|
|
+ // const { terserOptions } = args[0]
|
|
|
|
+ // terserOptions.compress.drop_console = true
|
|
|
|
+ // terserOptions.compress.drop_debugger = true
|
|
|
|
+ // return args
|
|
|
|
+ // })
|
|
|
|
+ } else {
|
|
config.devServer.set('inline', false)
|
|
config.devServer.set('inline', false)
|
|
config.devServer.set('hot', true)
|
|
config.devServer.set('hot', true)
|
|
}
|
|
}
|