1234567891011121314151617181920212223242526272829303132333435 |
- /*
- * @Author: PoJun
- * @Date: 2024-03-14 17:01:20
- * @LastEditors: PoJun
- * @LastEditTime: 2024-04-15 11:33:37
- * @Message: Nothing
- */
- const CompressionPlugin = require('compression-webpack-plugin');
- module.exports = {
- productionSourceMap: false,
- devServer: {
- open: true,
- hot: false,
- inline: false,
- liveReload: false,
- },
- css: {
- // 是否开启 CSS source maps
- sourceMap: false,
- requireModuleExtension: true,
- },
- configureWebpack: () => {
- if (process.env.NODE_ENV === 'production') {
- return {
- plugins: [
- new CompressionPlugin({
- test: /\.js$|\.css/, // 匹配文件名字
- threshold: 10240, // 对超过10k的数据进行压缩
- deleteOriginalAssets: false, // 是否删除源文件
- }),
- ],
- };
- }
- },
- };
|