Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const noop = () => {};
*/

/**
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, readFileSync?: import("fs").readFileSync }} OutputFileSystem
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, existsSync?: import("fs").existsSync, readFileSync?: import("fs").readFileSync }} OutputFileSystem
*/

/** @typedef {ReturnType<Compiler["getInfrastructureLogger"]>} Logger */
Expand Down Expand Up @@ -88,6 +88,7 @@ const noop = () => {};
* @property {boolean} [serverSideRender]
* @property {OutputFileSystem} [outputFileSystem]
* @property {boolean | string} [index]
* @property {boolean | undefined} [historyApiFallback]
*/

/**
Expand Down
5 changes: 3 additions & 2 deletions src/utils/getFilenameFromUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ function getFilenameFromUrl(context, url) {
}

if (
options.historyApiFallback &&
!context.outputFileSystem.existsSync(filename)
context.outputFileSystem.existsSync &&
!context.outputFileSystem.existsSync(filename) &&
options.historyApiFallback
) {
filename = path.join(outputPath);
}
Expand Down
2 changes: 1 addition & 1 deletion test/validation-options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("validation", () => {
},
historyApiFallback: {
success: [true],
failure: ["foo", 10],
failure: [],
},
serverSideRender: {
success: [true],
Expand Down
5 changes: 4 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export = wdm;
* @typedef {ReturnType<Compiler["watch"]>} MultiWatching
*/
/**
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, readFileSync?: import("fs").readFileSync }} OutputFileSystem
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, existsSync?: import("fs").existsSync, readFileSync?: import("fs").readFileSync }} OutputFileSystem
*/
/** @typedef {ReturnType<Compiler["getInfrastructureLogger"]>} Logger */
/**
Expand Down Expand Up @@ -66,6 +66,7 @@ export = wdm;
* @property {boolean} [serverSideRender]
* @property {OutputFileSystem} [outputFileSystem]
* @property {boolean | string} [index]
* @property {boolean | undefined} [historyApiFallback]
*/
/**
* @template {IncomingMessage} RequestInternal
Expand Down Expand Up @@ -172,6 +173,7 @@ type Options<
serverSideRender?: boolean | undefined;
outputFileSystem?: OutputFileSystem | undefined;
index?: string | boolean | undefined;
historyApiFallback?: boolean | undefined;
};
type API<
RequestInternal extends import("http").IncomingMessage,
Expand Down Expand Up @@ -204,6 +206,7 @@ type OutputFileSystem = Compiler["outputFileSystem"] & {
createReadStream?: typeof import("fs").createReadStream;
statSync?: import("fs").StatSyncFn;
lstat?: typeof import("fs").lstat;
existsSync?: typeof import("fs").existsSync;
readFileSync?: typeof import("fs").readFileSync;
};
type Logger = ReturnType<Compiler["getInfrastructureLogger"]>;
Expand Down