| 12345678910111213141516171819202122232425262728 |
- const CompressionPlugin = require('compression-webpack-plugin');
- module.exports = {
- publicPath: './',
- outputDir: './www',
- assetsDir: 'static',
- productionSourceMap: false,
- lintOnSave: true,
- filenameHashing: true,
- devServer: {
- https: false,
- port: 4562
- },
- configureWebpack: () => {
- if (process.env.NODE_ENV === 'production') {
- return {
- plugins: [
- new CompressionPlugin({
- minRatio: 1, // 压缩率小于1才会压缩
- test: /\.js$|.html$|\.css$/, // 匹配文件名
- threshold: 10240, // 对超过10k的文件进行压缩
- deleteOriginalAssets: false // 是否删除原文件
- })
- ]
- }
- }
- }
- }
|