Files
flagnote-web/vue.config.js
2022-11-22 14:58:24 +08:00

40 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { defineConfig } = require("@vue/cli-service");
const CompressionPlugin = require("compression-webpack-plugin");
module.exports = defineConfig({
assetsDir:'static',
productionSourceMap: false,
configureWebpack: {
// devtool: false,
plugins: [
new CompressionPlugin({
algorithm: "gzip", // 使用gzip压缩
test: /\.js$|\.html$|\.png$|\.jpg$|\.svg$|\.css$/, // 匹配文件名
filename: "[path][base].gz[query]", // 压缩后的文件名(保持原文件名,后缀加.gz)
minRatio: 1, // 压缩率小于1才会压缩
threshold: 5120, // 对超过10k的数据压缩
deleteOriginalAssets: false, // 是否删除未压缩的源文件谨慎设置如果希望提供非gzip的资源可不设置或者设置为false比如删除打包后的gz后还可以加载到原始资源文件
}),
],
},
transpileDependencies: true,
chainWebpack: (config) => {
config.plugin("html").tap((args) => {
args[0].title = "flagnote.com";
return args;
});
},
devServer: {
proxy: {
"/note": {
target: "http://localhost:3333/", // 后台接口域名
secure: false, // 如果是https接口需要配置这个参数
changeOrigin: true, //是否跨域
pathRewrite: {
// '^/': '/'
},
},
},
},
});