|
@@ -1,3 +1,4 @@
|
|
|
+const fs = require('fs');
|
|
|
const path = require('path')
|
|
|
const webpack = require('webpack')
|
|
|
const createThemeColorReplacerPlugin = require('./config/plugin.config')
|
|
@@ -5,6 +6,9 @@ const createThemeColorReplacerPlugin = require('./config/plugin.config')
|
|
|
const compressionWebpackPlugin = require('compression-webpack-plugin');
|
|
|
// js,css 压缩
|
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
|
+// 版本自动生成
|
|
|
+const WebpackVersionPlugin = require('webpack-version-plugin');
|
|
|
+const versionConfig = require(resolve('public/version.json'));
|
|
|
|
|
|
function resolve (dir) {
|
|
|
return path.join(__dirname, dir)
|
|
@@ -89,7 +93,17 @@ const vueConfig = {
|
|
|
threshold: 10240,
|
|
|
//只有压缩率小于这个值的资源才会被处理。默认值是 0.8。
|
|
|
minRatio: 0.8
|
|
|
- })
|
|
|
+ }),
|
|
|
+ new WebpackVersionPlugin({
|
|
|
+ // You must set the cb option
|
|
|
+ cb: function(hashMap) {
|
|
|
+ if(isProd()){
|
|
|
+ console.log(hashMap);
|
|
|
+ versionConfig.version = hashMap.app.chunkHash;
|
|
|
+ fs.writeFileSync(resolve('public/version.json'), JSON.stringify(versionConfig, null, 2));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
],
|
|
|
// if prod is on, add externals
|
|
|
externals: isProd() ? prodExternals : {}
|
|
@@ -198,7 +212,7 @@ const vueConfig = {
|
|
|
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
|
|
|
proxy: {
|
|
|
'/api': {
|
|
|
- target: 'http://192.168.16.151/qpls-md',
|
|
|
+ target: 'http://192.168.16.156:8076/qpls-md',
|
|
|
// target: 'http://p.iscm.360arrow.com/qpls-md',
|
|
|
// ws: false,
|
|
|
ws: true,
|