123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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',
- proxy: {
- '/files': {
- target: 'http://broadcast.waityou24.cn',
- },
- '/groupBuy/api': {
- target: 'http://192.168.223.1:14000',
- changeOrigin: true,
- },
- '/wechat/api': {
- target: 'http://192.168.223.1:14001',
- changeOrigin: true,
- },
- '/ws': {
- target: 'http://101.36.221.66',
- ws: false,
- },
- },
- },
- };
|