Skip to content

Commit

Permalink
fix: extensions
Browse files Browse the repository at this point in the history
- require.extensions is deprecated and doesn't include all JS extensions such as .ts, .mjs, ...

fixes: dividab#248
  • Loading branch information
its-dibo committed Jun 15, 2024
1 parent b4eb77b commit 63d53ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/match-path-async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function matchFromAbsolutePathsAsync(
requestedModule: string,
readJson: Filesystem.ReadJsonAsync = Filesystem.readJsonFromDiskAsync,
fileExists: Filesystem.FileExistsAsync = Filesystem.fileExistsAsync,
extensions: ReadonlyArray<string> = Object.keys(require.extensions),
extensions: ReadonlyArray<string> = ['.ts','.tsx','.js','.jsx','.mjs','.cjs','.json','.node'],
callback: MatchPathAsyncCallback,
mainFields: (string | string[])[] = ["main"]
): void {
Expand Down
2 changes: 1 addition & 1 deletion src/match-path-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function matchFromAbsolutePaths(
requestedModule: string,
readJson: Filesystem.ReadJsonSync = Filesystem.readJsonFromDiskSync,
fileExists: Filesystem.FileExistsSync = Filesystem.fileExistsSync,
extensions: Array<string> = Object.keys(require.extensions),
extensions: Array<string> = ['.ts','.tsx','.js','.jsx','.mjs','.cjs','.json','.node'],
mainFields: (string | string[])[] = ["main"]
): string | undefined {
const tryPaths = TryPath.getPathsToTry(
Expand Down

0 comments on commit 63d53ad

Please sign in to comment.