const path = require('path'); const common = path.resolve(__dirname, '../common'); const LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); const CompressionPlugin = require('compression-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const productionGzipExtensions = /\.(js|css|json|txt|svg|png)(\?.*)?$/i; module.exports = { publicPath: `/${process.env.VUE_APP_ROUTER}`, outputDir: process.env.VUE_APP_ROUTER, productionSourceMap: false, configureWebpack: (config) => { Object.assign(config, { resolve: { alias: { '@': path.resolve(__dirname, './src'), '@c': path.resolve(__dirname, './src/components'), '@a': path.resolve(__dirname, './src/assets'), '@common': common, }, }, }); if (process.env.NODE_ENV === 'production') { return { plugins: [ new CompressionPlugin({ test: productionGzipExtensions, threshold: 10240, deleteOriginalAssets: false, }), new BundleAnalyzerPlugin(), ], }; } }, chainWebpack: (config) => { if (process.env.NODE_ENV === 'production') { config.plugin('loadshReplace').use(new LodashModuleReplacementPlugin()); } }, devServer: { port: '8001', inline: true, proxy: { '/files': { target: 'http://baoan.fwedzgc.com:8090', }, '/api': { target: 'http://baoan.fwedzgc.com:8090', changeOrigin: true, ws: false, }, }, }, };