Skip to content

Commit

Permalink
Add option historyApiFallback
Browse files Browse the repository at this point in the history
  • Loading branch information
drudrum committed May 30, 2021
1 parent e350590 commit 209526e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
}
]
},
"historyApiFallback": {
"description": "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",
"anyOf": [
{
"type": "boolean"
}
]
},
"stats": {
"description": "Stats options object or preset name.",
"anyOf": [
Expand Down
5 changes: 4 additions & 1 deletion src/utils/getFilenameFromUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ export default function getFilenameFromUrl(context, url) {
filename = path.join(outputPath, querystring.unescape(pathname));
}

let fsStats;
if (!context.outputFileSystem.existsSync(filename) && options.historyApiFallback){
filename = path.join(outputPath);
}

let fsStats;
try {
fsStats = context.outputFileSystem.statSync(filename);
} catch (_ignoreError) {
Expand Down

0 comments on commit 209526e

Please sign in to comment.