-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Support for createRequire was added in:
However, this only works with mixedModules: true.
If this mode is not enabled, you get:
TypeError: Cannot read properties of undefined (reading 'shadowDepth')
623 | node.arguments[0].type === 'Literal' &&
624 | node.callee.type === 'Identifier' &&
> 625 | knownBindings.require.shadowDepth === 0) {
| ^
626 | await processRequireArg(node.arguments[0]);
627 | }
628 | break;
at Object.shadowDepth (out/analyze.js:625:55)
at AsyncWalker.visit (node_modules/estree-walker/dist/umd/estree-walker.js:234:6)
at AsyncWalker.visit (node_modules/estree-walker/dist/umd/estree-walker.js:271:7)
at AsyncWalker.visit (node_modules/estree-walker/dist/umd/estree-walker.js:264:15)
at AsyncWalker.visit (node_modules/estree-walker/dist/umd/estree-walker.js:264:15)
at asyncWalk (node_modules/estree-walker/dist/umd/estree-walker.js:336:10)
at analyze (out/analyze.js:508:5)
at Job.emitDependency (out/node-file-trace.js:340:29)
at async Promise.all (index 0)
at nodeFileTrace (out/node-file-trace.js:62:5)
at doTrace (test/unit.test.js:153:37)
at Object.<anonymous> (test/unit.test.js:342:5)
The error at this line is because knownBindings.require is undefined when the file is ESM and mixedModules: false:
Line 734 in b10961a
| knownBindings.require.shadowDepth === 0 |
This was not picked up buy the tests because it looks like they all have mixedModules enabled:
Line 169 in b10961a
| mixedModules: true, |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working