Skip to content

Commit ef55d48

Browse files
crisbetothePunderWoman
authored andcommitted
refactor(compiler-cli): avoid naming conflict with built-in global variable (#54333)
The import of `module` can conflict with the native global variable called `module` and can break some internal tests. These switch to only importing the function we need. PR Close #54333
1 parent 8d4b4ff commit ef55d48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/compiler-cli/src/ngtsc/file_system/src/node_js_file_system.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
/// <reference types="node" />
99
import fs from 'fs';
10-
import module from 'module';
10+
import {createRequire} from 'module';
1111
import * as p from 'path';
1212
import {fileURLToPath} from 'url';
1313

@@ -96,7 +96,7 @@ export class NodeJSReadonlyFileSystem extends NodeJSPathManipulation implements
9696
}
9797
getDefaultLibLocation(): AbsoluteFsPath {
9898
// G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
99-
const requireFn = isCommonJS ? require : module.createRequire(currentFileUrl!);
99+
const requireFn = isCommonJS ? require : createRequire(currentFileUrl!);
100100
return this.resolve(requireFn.resolve('typescript'), '..');
101101
}
102102
}

0 commit comments

Comments
 (0)