web file package config

This commit is contained in:
QAIU
2024-11-07 12:34:24 +08:00
parent 4455bee570
commit a01df6c7db

View File

@@ -5,9 +5,10 @@ function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }
const CompressionPlugin = require('compression-webpack-plugin'); const CompressionPlugin = require('compression-webpack-plugin');
// const FileManagerPlugin = require('filemanager-webpack-plugin') const FileManagerPlugin = require('filemanager-webpack-plugin')
module.exports = { module.exports = {
productionSourceMap: false, // 是否在构建生产包时生成sourceMap文件false将提高构建速度
transpileDependencies: true, transpileDependencies: true,
lintOnSave: false, lintOnSave: false,
outputDir: 'nfd-front', outputDir: 'nfd-front',
@@ -21,9 +22,6 @@ module.exports = {
}, },
} }
}, },
build: {
productionSourceMap: false, // 是否在构建生产包时生成sourceMap文件false将提高构建速度
},
configureWebpack: { configureWebpack: {
// provide the app's title in webpack's name field, so that // provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title. // it can be accessed in index.html to inject the correct title.
@@ -33,23 +31,28 @@ module.exports = {
'@': resolve('src') '@': resolve('src')
} }
}, },
plugins: [ plugins: [
new CompressionPlugin({ new CompressionPlugin({
test: /\.js$|\.html$|\.css/, // 匹配文件 test: /\.js$|\.html$|\.css/, // 匹配文件
threshold: 10240 // 对超过10k文件压缩 threshold: 10240 // 对超过10k文件压缩
}), }),
// new FileManagerPlugin({ //初始化 filemanager-webpack-plugin 插件实例 new FileManagerPlugin({ //初始化 filemanager-webpack-plugin 插件实例
// onEnd: { events: {
// mkdir: ['./nfd-front'], onEnd: {
// delete: [ //首先需要删除项目根目录下的dist.zip mkdir: ['./nfd-front'],
// './nfd-front.zip', copy: [
// ], { source: './nfd-front', destination: '../webroot/nfd-front' }
// archive: [ //然后我们选择dist文件夹将之打包成dist.zip并放在根目录 ],
// {source: './nfd-front', destination: './nfd-front.zip'}, delete: [ //首先需要删除项目根目录下的dist.zip
// ] './nfd-front.zip',
// } '../webroot/nfd-front',
// }) ],
archive: [ //然后我们选择dist文件夹将之打包成dist.zip并放在根目录
{source: './nfd-front', destination: './nfd-front.zip'},
]
}
}
})
] ]
}, },