Skip to content

Commit ae3efd1

Browse files
committed
fix: accept editions
1 parent 32c3d90 commit ae3efd1

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/utils/getFilenameFromUrl.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export default function getFilenameFromUrl(context, url) {
5454
}
5555

5656
if (
57-
!context.outputFileSystem.existsSync(filename) &&
58-
options.historyApiFallback
57+
options.historyApiFallback &&
58+
!context.outputFileSystem.existsSync(filename)
5959
) {
6060
filename = path.join(outputPath);
6161
}

test/__snapshots__/validation-options.test.js.snap.webpack5

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ exports[`validation should throw an error on the "headers" option with "true" va
2020
* options.headers should be an instance of function."
2121
`;
2222

23+
exports[`validation should throw an error on the "historyApiFallback" option with "10" value 1`] = `
24+
"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
25+
- options.historyApiFallback should be a boolean.
26+
-> When using the HTML5 History API, the index.html page will likely have to be served in place of any 404 responses. Enable historyApiFallback by setting it to true"
27+
`;
28+
29+
exports[`validation should throw an error on the "historyApiFallback" option with "foo" value 1`] = `
30+
"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
31+
- options.historyApiFallback should be a boolean.
32+
-> When using the HTML5 History API, the index.html page will likely have to be served in place of any 404 responses. Enable historyApiFallback by setting it to true"
33+
`;
34+
2335
exports[`validation should throw an error on the "index" option with "{}" value 1`] = `
2436
"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
2537
- options.index should be one of these:

test/validation-options.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe("validation", () => {
3737
},
3838
historyApiFallback: {
3939
success: [true],
40-
failure: [],
40+
failure: ["foo", 10],
4141
},
4242
serverSideRender: {
4343
success: [true],

0 commit comments

Comments
 (0)