diff --git a/.env.prd b/.env.prd new file mode 100644 index 0000000..a8125c1 --- /dev/null +++ b/.env.prd @@ -0,0 +1,9 @@ +# env +NODE_ENV = 'prd' // 如果是生产环境,请记得切换为production + +# flag +VUE_APP_FLAG='prd' +VUE_APP_ADMIN='http://39.104.123.254:7196' +VUE_APP_STATIC='http://39.104.123.254:7536/' + + diff --git a/package.json b/package.json index 212ceba..e1ee98f 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "serve": "NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", "build": "vue-cli-service build", "build:dev": "vue-cli-service build --mode dev", + "build:prd": "vue-cli-service build --mode prd", "dev": "vue-cli-service serve --mode dev", "preview": "node build/index.js --preview", "lint": "eslint --ext .js,.vue src", @@ -19,6 +20,7 @@ "dependencies": { "alova": "^3.2.10", "axios": "0.18.1", + "compression-webpack-plugin": "^6.1.2", "cropperjs": "^2.0.0", "crypto-js": "^4.0.0", "crypto.js": "^2.0.2", diff --git a/vue.config.js b/vue.config.js index 879e941..cae2a7b 100644 --- a/vue.config.js +++ b/vue.config.js @@ -145,7 +145,7 @@ module.exports = { config.optimization.splitChunks({ chunks: 'all', minSize: 3000, - maxSize: 6000, + maxSize: 9000, maxInitialRequests: 3, cacheGroups: { libs: { @@ -169,6 +169,10 @@ module.exports = { } }) config.optimization.runtimeChunk('single') + // 添加时间戳到文件名中 }) + config.output + .filename(`js/[name].[hash:8].js`) + .chunkFilename(`js/[name].[hash:8].js`) } }