Commit ecf6b47a authored by liaozan's avatar liaozan 🏀

chore: make web resource be gzip

parent 0a81fa1e
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "cross-env NODE_ENV=dev vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "cross-env NODE_ENV=prod vue-cli-service build ", "build": "vue-cli-service build ",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"axios": "^0.26.1", "axios": "^0.26.1",
"core-js": "^3.21.1", "core-js": "^3.21.1",
"cross-env": "^7.0.3",
"element-plus": "^2.1.4", "element-plus": "^2.1.4",
"vue": "^3.2.31", "vue": "^3.2.31",
"vue-router": "^4.0.14" "vue-router": "^4.0.14"
...@@ -27,4 +26,4 @@ ...@@ -27,4 +26,4 @@
"not dead", "not dead",
"not ie 11" "not ie 11"
] ]
} }
\ No newline at end of file
...@@ -2,8 +2,8 @@ import axios from 'axios'; ...@@ -2,8 +2,8 @@ import axios from 'axios';
import {hideLoading, showLoading} from './loading' import {hideLoading, showLoading} from './loading'
const envDict = { const envDict = {
'dev': 'http://localhost:8080', 'development': 'http://localhost:8080',
'prod': 'http://192.168.36.27:8080' 'production': 'http://192.168.36.27:8080'
} }
axios.defaults.baseURL = envDict[process.env.NODE_ENV] axios.defaults.baseURL = envDict[process.env.NODE_ENV]
......
...@@ -3,13 +3,12 @@ const CompressionPlugin = require("compression-webpack-plugin") ...@@ -3,13 +3,12 @@ const CompressionPlugin = require("compression-webpack-plugin")
module.exports = defineConfig({ module.exports = defineConfig({
transpileDependencies: true, transpileDependencies: true,
chainWebpack: (config) => { chainWebpack: config => {
config.plugin('compressionPlugin') config.plugin('compressPlugin')
.use(new CompressionPlugin({ .use(new CompressionPlugin({
test: /\.js$|\.html$|\.css/, // 匹配文件名 test: /\.js$|\.html$|\.css/,
threshold: 10240, // 对超过10k的数据压缩 threshold: 10240,
deleteOriginalAssets: false // 不删除源文件 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