Skip to content

Commit 77d5592

Browse files
committed
fix: config.target:web webpack config error
1 parent d5090e9 commit 77d5592

6 files changed

Lines changed: 12 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ run/
99
vscode
1010
*.iml
1111
package-lock.json
12+
yarn.lock

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ language: node_js
33
node_js:
44
- '6'
55
- '8'
6-
- '9'
6+
- '10'
77
install:
88
- npm i npminstall && npminstall
99
script:

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ environment:
22
matrix:
33
- nodejs_version: '6'
44
- nodejs_version: '8'
5-
- nodejs_version: '9'
5+
- nodejs_version: '10'
66

77
install:
88
- ps: Install-Product node $env:nodejs_version

lib/server.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ class WebpackServer extends WebpackTool {
88
super(config);
99
this.agent = agent;
1010
this.port = Utils.getPort(config.port);
11+
const webpackConfigList = Array.isArray(this.config.webpackConfigList) ? this.config.webpackConfigList : [this.config.webpackConfigList];
12+
if (webpackConfigList.length) {
13+
this.webpackConfigList = webpackConfigList;
14+
} else {
15+
this.webpackConfigList = Utils.getWebpackConfig(config, { baseDir: this.agent.baseDir || process.cwd() });
16+
}
1117
}
1218

1319
start() {
1420
build.dll(this.config, { baseDir: this.agent.baseDir }, () => {
15-
const compilers = this.dev(this.config.webpackConfigList, {}, () => {
21+
const compilers = this.dev(this.webpackConfigList, {}, () => {
1622
this.finish();
1723
});
1824
this.listen(compilers);

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ exports.isUseMultProcess = (baseDir, pluginConfig) => {
5050
}
5151
const cliConfig = exports.getWebpackConfigJSON(baseDir, pluginConfig);
5252
if (cliConfig) {
53-
if (cliConfig.type === undefined || cliConfig.target === undefined) {
53+
if (cliConfig.type === undefined && cliConfig.target === undefined) {
5454
return true;
5555
}
5656
if (Array.isArray(cliConfig.type) && cliConfig.type.length > 1) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egg-webpack",
3-
"version": "4.4.4",
3+
"version": "4.4.5",
44
"description": "webpack dev server plugin for egg, support read file in memory and hot reload.",
55
"eggPlugin": {
66
"name": "webpack",

0 commit comments

Comments
 (0)