Commit cf77ff57 authored by 张伯涛's avatar 张伯涛

打包时gzip压缩

parent ad0c4ea3
# just a flag
ENV = 'test'
NODE_ENV= 'production'
# 测试环境
# base api
VUE_APP_BASE_API = 'http://192.144.239.97:20075/'
......@@ -14,6 +14,8 @@ function resolve(dir) {
const name = defaultSettings.title || 'vue Admin Template' // page title
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
const port = process.env.port || process.env.npm_config_port || 8080 // dev port
......@@ -47,8 +49,8 @@ module.exports = {
// },
proxy: {
[process.env.VUE_APP_BASE_API]: {
target: `http://49.232.167.247:20014/`, // 线上
// target: `http://192.168.1.30:8082/`,
// target: `http://49.232.167.247:20014/`, // 线上
target: `http://192.168.1.30:8001/`,
// changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
......@@ -60,6 +62,15 @@ module.exports = {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
name: name,
plugins: [
new CompressionWebpackPlugin({
filename: '[path].gz[query]', // 提示compression-webpack-plugin@3.0.0的话asset改为filename
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
],
resolve: {
alias: {
'@': resolve('src')
......
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