+48
-3
lines changedFilter options
+48
-3
lines changed Original file line number Diff line number Diff line change
@@ -61,3 +61,47 @@ test('createServer should return an object containing a development Webpack comp
61
61
expect(output.chunkFilename).toBe('build/[name].js');
62
62
done();
63
63
});
64
+
65
+
test('createServer should apply some base config options', () => {
66
+
process.chdir('test/apps/basic');
67
+
const config = {
68
+
...getConfig(),
69
+
serverHost: 'localhost',
70
+
serverPort: 6000,
71
+
};
72
+
const result = createServer(config, 'development');
73
+
expect(result).toBeTruthy();
74
+
expect(result.compiler).toBeTruthy();
75
+
expect(result.compiler.options.devServer).toMatchObject({
76
+
host: 'localhost',
77
+
port: 6000,
78
+
compress: true,
79
+
hot: true,
80
+
client: { logging: 'none' },
81
+
webSocketServer: 'ws',
82
+
});
83
+
});
84
+
85
+
test('createServer should allow overriding default devServer options', () => {
86
+
process.chdir('test/apps/basic');
87
+
const config = {
88
+
...getConfig(),
89
+
webpackConfig: {
90
+
devServer: {
91
+
client: {
92
+
overlay: false,
93
+
progress: true,
94
+
},
95
+
},
96
+
},
97
+
};
98
+
const result = createServer(config, 'development');
99
+
expect(result).toBeTruthy();
100
+
expect(result.compiler).toBeTruthy();
101
+
expect(result.compiler.options.devServer).toMatchObject({
102
+
client: {
103
+
overlay: false,
104
+
progress: true,
105
+
},
106
+
});
107
+
});
Original file line number Diff line number Diff line change
@@ -33,13 +33,14 @@ export default function createServer(
33
33
},
34
34
};
35
35
36
-
const webpackDevServerConfig: Configuration = {
37
-
...webpackConfig.devServer,
36
+
// Allow custom devServer options to override base config.
37
+
webpackConfig.devServer = {
38
38
...baseConfig,
39
+
...webpackConfig.devServer,
39
40
};
40
41
41
42
const compiler = webpack(webpackConfig);
42
-
const devServer = new WebpackDevServer(webpackDevServerConfig, compiler);
43
+
const devServer = new WebpackDevServer(webpackConfig.devServer, compiler);
43
44
44
45
// User defined customizations
45
46
if (config.configureServer) {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4