From ede98df0e9275d7de45656ca557dd1102d627c77 Mon Sep 17 00:00:00 2001 From: sky Date: Thu, 29 Mar 2018 17:10:24 +0800 Subject: [PATCH] fix: stats port --- config/plugin.js | 8 +++++--- lib/dll.js | 1 + package.json | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/config/plugin.js b/config/plugin.js index bcbc321..9bb06b7 100644 --- a/config/plugin.js +++ b/config/plugin.js @@ -210,9 +210,10 @@ exports.analyzer = { name: 'webpack-bundle-analyzer', entry: 'BundleAnalyzerPlugin', args() { + const prefix = this.dll ? 'dll' : this.type; return { - analyzerPort: this.ssr ? 9998 : 9999, - statsFilename: this.type ? this.type + '_analyzer_stats.json' : 'analyzer_stats.json' + analyzerPort: this.dll ? 9997 : this.ssr ? 9998 : 9999, + statsFilename: prefix ? prefix + '_analyzer_stats.json' : 'analyzer_stats.json' }; } }; @@ -221,11 +222,12 @@ exports.stats = { enable: false, name: 'stats-webpack-plugin', args() { + const prefix = this.dll ? 'dll' : this.type; const args = [{ chunkModules: true, exclude: [/node_modules[\\\/]/] }]; - args.unshift(this.type ? this.type + '_stats.json' : 'stats.json'); + args.unshift(prefix ? prefix + '_stats.json' : 'stats.json'); return args; } }; diff --git a/lib/dll.js b/lib/dll.js index 66016a0..55c710a 100644 --- a/lib/dll.js +++ b/lib/dll.js @@ -8,6 +8,7 @@ const Config = require('../config/config'); class WebpackDllBuilder extends WebpackBaseBuilder { constructor(config) { super(merge({ useHost: false, buildDll: true }, config)); + this.dll = true; this.type = WebpackDllBuilder.TYPE; this.mergeConfig(Config.dllConfig); this.setBuildPath(this.utils.getDllCompileFileDir(this.env)); diff --git a/package.json b/package.json index d95e81c..5e6e4c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "easywebpack", - "version": "4.2.1", + "version": "4.2.2", "description": "基于 Webpack 的前端构建工程化解决方案", "keywords": [ "webpack",