We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 10a0650 commit ffe969aCopy full SHA for ffe969a
lib/internal/loader/ModuleRequest.js
@@ -36,9 +36,12 @@ loaders.set('esm', async (url) => {
36
});
37
38
// Strategy for loading a node-style CommonJS module
39
+const isWindows = process.platform === 'win32';
40
+const winSepRegEx = /\//g;
41
loaders.set('cjs', async (url) => {
42
const pathname = internalURLModule.getPathFromURL(new URL(url));
- const module = CJSModule._cache[pathname];
43
+ const module = CJSModule._cache[
44
+ isWindows ? pathname.replace(winSepRegEx, '\\') : pathname];
45
if (module && module.loaded) {
46
const ctx = createDynamicModule(['default'], url, undefined);
47
ctx.reflect.exports.default.set(module.exports);
0 commit comments