const CompressionWebpackPlugin = require('compression-webpack-plugin'); // 开启压缩 const webpack = require('webpack'); // const isProduction = process.env.NODE_ENV === 'production'; module.exports = { publicPath: './', productionSourceMap: false, devServer: { port: 8081, }, pages: { mobile: { entry: 'src/mobile.js', template: 'public/mobile.html', filename: 'mobile.html' }, index: { entry: 'src/main.js', template: 'public/index.html', filename: 'index.html' }, }, chainWebpack: config => { config.plugins.delete('prefetch') }, css: { extract: { Type: true, }, loaderOptions: { css: {}, postcss: { plugins: [ require('postcss-plugin-px2rem')({ rootValue: 75, exclude: /(node_module)/, }), ] } } }, configureWebpack: { // 服务器也要相应开启gzip plugins: [ // new CompressionWebpackPlugin({ // algorithm: 'gzip', // test: /\.(js|css|png)$/, // 匹配文件名 // threshold: 0, // 对超过10k的数据压缩 // deleteOriginalAssets: true, // 不删除源文件 // minRatio: 0.8 // 压缩比 // }), new webpack.optimize.LimitChunkCountPlugin({ maxChunks:20, minChunkSize: 1000 }) ] } }