123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 'use strict';
- const path = require('path');
- const CompressionWebpackPlugin = require('compression-webpack-plugin');
- // const CopyWebpackPlugin = require('copy-webpack-plugin');
- // const WebpackBundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
- const productionGzipExtensions = ['js', 'css'];
- function resolve(dir) {
- return path.join(__dirname, dir);
- }
- module.exports = {
- publicPath: './',
- productionSourceMap: false,
- // devServer: {
- // proxy: {
- // '/traintripcomser': {
- // target: 'http://192.168.1.33:8202', // 后台接口域名
- // ws: true, //如果要代理 websockets,配置这个参数
- // secure: false, // 如果是https接口,需要配置这个参数
- // changeOrigin: true, //是否跨域
- // pathRewrite:{
- // '^/traintripcomser': '/traintripcomser'
- // },
- // logLevel: 'debug',
- // }
- // }
- // },
- configureWebpack: {
- plugins: [
- // new WebpackBundleAnalyzerPlugin(),
- new CompressionWebpackPlugin({
- filename: '[path][base].gz',
- algorithm: 'gzip',
- test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'), //匹配文件名
- threshold: 10240, //对10K以上的数据进行压缩
- minRatio: 0.8,
- deleteOriginalAssets: false, //是否删除源文件
- }),
- ],
- },
- };
|