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://12coffee.club:3333/", // 后台接口域名 secure: false, // 如果是https接口,需要配置这个参数 changeOrigin: true, //是否跨域 pathRewrite: { // '^/': '/' }, }, }, }, });