ko 5.3.2 → 5.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/actions/dev.js +14 -14
- package/lib/webpack/index.js +1 -1
- package/package.json +1 -1
package/lib/actions/dev.js
CHANGED
|
@@ -13,32 +13,31 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
|
13
13
|
class Dev extends creator_1.WebpackCreator {
|
|
14
14
|
constructor(opts) {
|
|
15
15
|
super(opts);
|
|
16
|
-
}
|
|
17
|
-
devSerConf() {
|
|
18
|
-
const userDefinedDevServerConfig = config_1.default.userConf.devServer || {};
|
|
19
16
|
const { port, host } = this.opts;
|
|
20
|
-
const
|
|
17
|
+
const userDefinedDevServerConfig = config_1.default.userConf.devServer || {};
|
|
18
|
+
this.devServerConf = {
|
|
21
19
|
port,
|
|
22
20
|
host,
|
|
23
21
|
historyApiFallback: true,
|
|
24
22
|
allowedHosts: 'all',
|
|
25
|
-
hot: true,
|
|
26
23
|
static: {
|
|
27
|
-
directory: config_1.default.defaultPaths.dist,
|
|
28
24
|
publicPath: '/',
|
|
29
|
-
watch: true,
|
|
30
25
|
},
|
|
31
26
|
client: {
|
|
32
|
-
overlay:
|
|
27
|
+
overlay: {
|
|
28
|
+
errors: true,
|
|
29
|
+
warnings: false,
|
|
30
|
+
},
|
|
33
31
|
},
|
|
34
32
|
setupExitSignals: true,
|
|
33
|
+
...userDefinedDevServerConfig,
|
|
35
34
|
};
|
|
36
|
-
return { ...defaultDevServerConfig, ...userDefinedDevServerConfig };
|
|
37
35
|
}
|
|
38
36
|
config() {
|
|
39
37
|
const conf = {
|
|
40
38
|
devtool: 'cheap-module-source-map',
|
|
41
39
|
plugins: [this.opts.analyzer && new BundleAnalyzerPlugin()].filter(Boolean),
|
|
40
|
+
devServer: this.devServerConf,
|
|
42
41
|
};
|
|
43
42
|
return this.mergeConfig([this.baseConfig, conf]);
|
|
44
43
|
}
|
|
@@ -68,20 +67,21 @@ class Dev extends creator_1.WebpackCreator {
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
async action() {
|
|
71
|
-
const
|
|
72
|
-
const { port } = devSerConf;
|
|
70
|
+
const { port } = this.devServerConf;
|
|
73
71
|
const newPort = await this.checkPort(parseInt(port));
|
|
74
72
|
if (!newPort) {
|
|
75
73
|
process.exit(0);
|
|
76
74
|
}
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
const
|
|
75
|
+
this.devServerConf.port = newPort;
|
|
76
|
+
const config = this.config();
|
|
77
|
+
const compiler = (0, webpack_1.default)(config);
|
|
78
|
+
const devServer = new webpack_dev_server_1.default(config.devServer, compiler);
|
|
80
79
|
await devServer.start();
|
|
81
80
|
process.stdin.on('end', () => {
|
|
82
81
|
devServer.stop();
|
|
83
82
|
process.exit(0);
|
|
84
83
|
});
|
|
84
|
+
process.stdin.resume();
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
exports.default = Dev;
|
package/lib/webpack/index.js
CHANGED