|
@@ -1,5 +1,6 @@
|
|
|
const path = require('path')
|
|
|
-
|
|
|
+const CompressionPlugin = require('compression-webpack-plugin')
|
|
|
+const TerserPlugin = require("terser-webpack-plugin");
|
|
|
function resolve(dir) {
|
|
|
return path.join(__dirname, dir)
|
|
|
}
|
|
@@ -22,7 +23,32 @@ module.exports = {
|
|
|
}
|
|
|
},
|
|
|
*/
|
|
|
- configureWebpack: {},
|
|
|
+ configureWebpack: config => {
|
|
|
+ if (process.env.NODE_ENV === 'production') {
|
|
|
+ return {
|
|
|
+ plugins: [new CompressionPlugin({
|
|
|
+ test: /\.js$|\.html$|\.css/,
|
|
|
+ threshold: 10240,
|
|
|
+ deleteOriginalAssets: false
|
|
|
+ }), new TerserPlugin({
|
|
|
+ cache: true,//降版本后添加
|
|
|
+ sourceMap: false,//降版本后添加
|
|
|
+ // 多进程
|
|
|
+ parallel: true,//降版本后添加
|
|
|
+ terserOptions: {
|
|
|
+ ecma: undefined,
|
|
|
+ warnings: false,
|
|
|
+ parse: {},
|
|
|
+ compress: {
|
|
|
+ drop_console: true,
|
|
|
+ drop_debugger: false,
|
|
|
+ pure_funcs: ['console.log'], // 移除console
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }),]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
chainWebpack: (config) => {
|
|
|
config.resolve.alias
|
|
@@ -33,7 +59,8 @@ module.exports = {
|
|
|
.set('@comp', resolve('src/components'))
|
|
|
.set('@views', resolve('src/views'))
|
|
|
.set('@layout', resolve('src/layout'))
|
|
|
- .set('@static', resolve('src/static'))
|
|
|
+ .set('@static', resolve('src/static'));
|
|
|
+ config.plugins.delete('prefetch')
|
|
|
},
|
|
|
pluginOptions: {
|
|
|
'style-resources-loader': {
|
|
@@ -61,58 +88,58 @@ module.exports = {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- devServer: {
|
|
|
- hot:true,
|
|
|
- // inline: true,
|
|
|
- port: 3000,
|
|
|
- open : true,
|
|
|
- proxy: {
|
|
|
- '/jeecg-boot': {
|
|
|
- // target: 'http://192.168.1.8:8080', //请求本地 需要jeecg-boot后台项目 蒙蒙
|
|
|
- // target: 'http://192.168.1.3:8080', //请求本地 需要jeecg-boot后台项目 蒙蒙
|
|
|
+ devServer: {
|
|
|
+ hot: true,
|
|
|
+ // inline: true,
|
|
|
+ port: 3000,
|
|
|
+ open: true,
|
|
|
+ proxy: {
|
|
|
+ '/jeecg-boot': {
|
|
|
+ // target: 'http://192.168.1.8:8080', //请求本地 需要jeecg-boot后台项目 蒙蒙
|
|
|
+ // target: 'http://192.168.1.3:8080', //请求本地 需要jeecg-boot后台项目 蒙蒙
|
|
|
// target: 'http://192.168.1.3:7001', //请求本地 需要jeecg-boot后台项目 蒙蒙
|
|
|
- // target: 'http://192.168.0.59:8088', //请求本地 需要jeecg-boot后台项目 英豪
|
|
|
- // target: 'http://192.168.1.62:7001', //请求本地 需要jeecg-boot后台项目 英豪
|
|
|
- // target: 'http://192.168.6.162:9806', //请求本地 需要jeecg-boot后台项目 祚云
|
|
|
- // target: 'http://192.168.1.43:8098', //请求本地 需要jeecg-boot后台项目 毕洁泉
|
|
|
- // target: 'http://192.168.1.43:8088', //请求本地 需要jeecg-boot后台项目 毕洁泉
|
|
|
- // target: 'http://192.168.1.43:8806', //请求本地 需要jeecg-boot后台项目 毕洁泉
|
|
|
- // target: 'http://192.168.0.252:8098', //请求本地 需要jeecg-boot后台项目 毕洁泉
|
|
|
- // target: 'http://192.168.1.219:8081', //请求本地 需要jeecg-boot后台项目 赵西安
|
|
|
- // target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目 李煜一
|
|
|
- // target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目 李煜一
|
|
|
- target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
|
|
|
- // target: 'https://trac.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
|
|
|
- // target: 'http://39.106.184.70:8088/', //请求本地 需要jeecg-boot后台项目
|
|
|
- // target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目
|
|
|
- // target: 'http://192.168.1.251/', //请求本地 需要jeecg-boot后台项目
|
|
|
- // target:'http://118.24.244.213:8804',
|
|
|
- // target: 'http://192.168.1.43:9090', // 子安
|
|
|
- // target: 'http://192.168.1.8:8806', // 学超
|
|
|
- // target:'http://139.186.165.84:8806', //测试
|
|
|
- // target:'http://apipre.tjyourong.com.cn', //预生产
|
|
|
+ // target: 'http://192.168.0.59:8088', //请求本地 需要jeecg-boot后台项目 英豪
|
|
|
+ // target: 'http://192.168.1.62:7001', //请求本地 需要jeecg-boot后台项目 英豪
|
|
|
+ // target: 'http://192.168.6.162:9806', //请求本地 需要jeecg-boot后台项目 祚云
|
|
|
+ // target: 'http://192.168.1.43:8098', //请求本地 需要jeecg-boot后台项目 毕洁泉
|
|
|
+ // target: 'http://192.168.1.43:8088', //请求本地 需要jeecg-boot后台项目 毕洁泉
|
|
|
+ // target: 'http://192.168.1.43:8806', //请求本地 需要jeecg-boot后台项目 毕洁泉
|
|
|
+ // target: 'http://192.168.0.252:8098', //请求本地 需要jeecg-boot后台项目 毕洁泉
|
|
|
+ // target: 'http://192.168.1.219:8081', //请求本地 需要jeecg-boot后台项目 赵西安
|
|
|
+ // target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目 李煜一
|
|
|
+ // target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目 李煜一
|
|
|
+ target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
|
|
|
+ // target: 'https://trac.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
|
|
|
+ // target: 'http://39.106.184.70:8088/', //请求本地 需要jeecg-boot后台项目
|
|
|
+ // target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目
|
|
|
+ // target: 'http://192.168.1.251/', //请求本地 需要jeecg-boot后台项目
|
|
|
+ // target:'http://118.24.244.213:8804',
|
|
|
+ // target: 'http://192.168.1.43:9090', // 子安
|
|
|
+ // target: 'http://192.168.1.8:8806', // 学超
|
|
|
+ // target:'http://139.186.165.84:8806', //测试
|
|
|
+ // target:'http://apipre.tjyourong.com.cn', //预生产
|
|
|
// target: 'http://192.168.1.134:8080', //请求本地 需要jeecg-boot后台项目 周泽宇
|
|
|
|
|
|
// target:'http://gateway.tjyourong.com.cn/',//测试
|
|
|
|
|
|
- ws: false,
|
|
|
+ ws: false,
|
|
|
|
|
|
- // changeOrigin: true,
|
|
|
- // pathRewrite: {
|
|
|
- // '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
|
|
|
- // }
|
|
|
- },
|
|
|
- },
|
|
|
- // before(app) {
|
|
|
- // app.get('/seller', (req, res) => {
|
|
|
- // res.json({
|
|
|
- // errno: 0,
|
|
|
- // data: appData
|
|
|
- // })//接口返回json数据,上面配置的数据seller就赋值给data请求后调用
|
|
|
- // })
|
|
|
- // }
|
|
|
- },
|
|
|
+ // changeOrigin: true,
|
|
|
+ // pathRewrite: {
|
|
|
+ // '/jeecg-boot': '' //默认所有请求都加了jeecg-boot前缀,需要去掉
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // before(app) {
|
|
|
+ // app.get('/seller', (req, res) => {
|
|
|
+ // res.json({
|
|
|
+ // errno: 0,
|
|
|
+ // data: appData
|
|
|
+ // })//接口返回json数据,上面配置的数据seller就赋值给data请求后调用
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ },
|
|
|
|
|
|
lintOnSave: undefined,
|
|
|
-// publicPath:'./',
|
|
|
+ // publicPath:'./',
|
|
|
}
|