|
@@ -1,7 +1,8 @@
|
|
|
+const CompressionPlugin = require('compression-webpack-plugin')
|
|
|
module.exports = {
|
|
|
devServer: {
|
|
|
port: 8091,
|
|
|
- open:true,
|
|
|
+ open: true,
|
|
|
// 关闭esline
|
|
|
overlay: {
|
|
|
warnings: false,
|
|
@@ -53,4 +54,23 @@ module.exports = {
|
|
|
outputDir: 'wandaTopol',
|
|
|
// 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
|
|
|
assetsDir: 'static',
|
|
|
+ productionSourceMap: false,
|
|
|
+ // CSS 相关选项
|
|
|
+ css: {
|
|
|
+ // 将组件内的 CSS 提取到一个单独的 CSS 文件 (只用在生产环境中)
|
|
|
+ extract: true,
|
|
|
+ },
|
|
|
+ // 配置webpack
|
|
|
+ configureWebpack: (config) => {
|
|
|
+ return {
|
|
|
+ plugins: [
|
|
|
+ // 压缩代码
|
|
|
+ new CompressionPlugin({
|
|
|
+ test: /\.js$|\.html$|.\css/, // 匹配文件名
|
|
|
+ threshold: 10240, // 对超过10k的数据压缩
|
|
|
+ deleteOriginalAssets: false, // true 不删除源文件 false 删除源文件
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|