Skip to content

Commit 4e3806e

Browse files
bebrawjonathanglasmeyer
authored andcommitted
feat(webpack-dev-server): Support object for historyApiFallback
As documented at https://webpack.github.io/docs/webpack-dev-server.html#the-historyapifallback-option . Closes #82.
1 parent 16eca47 commit 4e3806e

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

src/properties/devServer/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export default Joi.object({
1818
Joi.array(),
1919
Joi.string(),
2020
],
21-
historyApiFallback: Joi.boolean(),
21+
historyApiFallback: Joi.alternatives().try([
22+
Joi.object(),
23+
Joi.boolean(),
24+
]),
2225
compress: Joi.boolean(),
2326
port: Joi.number(),
2427
public: Joi.string(),

src/properties/devServer/index.test.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,48 +32,50 @@ const validModuleConfigs = [
3232
// #13
3333
{ historyApiFallback: true },
3434
// #14
35-
{ compress: true },
35+
{ historyApiFallback: { index: '/foo-app/' } },
3636
// #15
37-
{ port: 3000 },
37+
{ compress: true },
3838
// #16
39-
{ public: 'localhost' },
39+
{ port: 3000 },
4040
// #17
41-
{ host: '0.0.0.0' },
41+
{ public: 'localhost' },
4242
// #18
43-
{ publicPath: '/public/path/' },
43+
{ host: '0.0.0.0' },
4444
// #19
45-
{ publicPath: 'public/path/' },
45+
{ publicPath: '/public/path/' },
4646
// #20
47-
{ outputPath: '/' },
47+
{ publicPath: 'public/path/' },
4848
// #21
49-
{ filename: 'bundle.js' },
49+
{ outputPath: '/' },
5050
// #22
51-
{ watchOptions: {} },
51+
{ filename: 'bundle.js' },
5252
// #23
53-
{ hot: true },
53+
{ watchOptions: {} },
5454
// #24
55-
{ stats: {} },
55+
{ hot: true },
5656
// #25
57-
{ stats: 'none' },
57+
{ stats: {} },
5858
// #26
59-
{ stats: 'errors-only' },
59+
{ stats: 'none' },
6060
// #27
61-
{ stats: 'minimal' },
61+
{ stats: 'errors-only' },
6262
// #28
63-
{ stats: 'normal' },
63+
{ stats: 'minimal' },
6464
// #29
65-
{ stats: 'verbose' },
65+
{ stats: 'normal' },
6666
// #30
67-
{ noInfo: true },
67+
{ stats: 'verbose' },
6868
// #31
69-
{ proxy: {} },
69+
{ noInfo: true },
7070
// #32
71-
{ proxy: 'http://proxy.url/' },
71+
{ proxy: {} },
7272
// #33
73-
{ proxy: [] },
73+
{ proxy: 'http://proxy.url/' },
7474
// #34
75-
{ staticOptions: {} },
75+
{ proxy: [] },
7676
// #35
77+
{ staticOptions: {} },
78+
// #36
7779
{ headers: {} },
7880
]
7981

0 commit comments

Comments
 (0)