Commit ecf6b47a authored by liaozan's avatar liaozan 🏀

chore: make web resource be gzip

parent 0a81fa1e
......@@ -3,14 +3,13 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "cross-env NODE_ENV=dev vue-cli-service serve",
"build": "cross-env NODE_ENV=prod vue-cli-service build ",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build ",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.26.1",
"core-js": "^3.21.1",
"cross-env": "^7.0.3",
"element-plus": "^2.1.4",
"vue": "^3.2.31",
"vue-router": "^4.0.14"
......
......@@ -2,8 +2,8 @@ import axios from 'axios';
import {hideLoading, showLoading} from './loading'
const envDict = {
'dev': 'http://localhost:8080',
'prod': 'http://192.168.36.27:8080'
'development': 'http://localhost:8080',
'production': 'http://192.168.36.27:8080'
}
axios.defaults.baseURL = envDict[process.env.NODE_ENV]
......
......@@ -3,13 +3,12 @@ const CompressionPlugin = require("compression-webpack-plugin")
module.exports = defineConfig({
transpileDependencies: true,
chainWebpack: (config) => {
config.plugin('compressionPlugin')
chainWebpack: config => {
config.plugin('compressPlugin')
.use(new CompressionPlugin({
test: /\.js$|\.html$|\.css/, // 匹配文件名
threshold: 10240, // 对超过10k的数据压缩
deleteOriginalAssets: false // 不删除源文件
test: /\.js$|\.html$|\.css/,
threshold: 10240,
deleteOriginalAssets: false
}))
}
})
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment