You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mkdir test && cd test
yarn init --yes
yarn add @babel/helper-validator-identifier
node
Welcome to Node.js v14.6.0.
Type ".help" for more information.
> require('@babel/helper-validator-identifier')
How often does it reproduce? Is there a required condition?
Must reproduce
What is the expected behavior?
It should require the module.
What do you see instead?
Uncaught:
TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "/test/node_modules/@babel/helper-validator-identifier/lib/index.js" must not include encoded "/" or "\" characters imported from /test/node_modules/@babel/helper-validator-identifier/
at resolveExportsTarget (internal/modules/cjs/loader.js:564:15)
at applyExports (internal/modules/cjs/loader.js:469:14)
at resolveExports (internal/modules/cjs/loader.js:522:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:654:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1052:27)
at Function.Module._load (internal/modules/cjs/loader.js:911:27)
at Module.require (internal/modules/cjs/loader.js:1125:19)
at require (internal/modules/cjs/helpers.js:75:18)
at repl:1:1
at Script.runInThisContext (vm.js:132:18) {
code: 'ERR_INVALID_MODULE_SPECIFIER'
}
What steps will reproduce the bug?
(Credits to @proteriax)
How often does it reproduce? Is there a required condition?
Must reproduce
What is the expected behavior?
It should require the module.
What do you see instead?
One can verify the package is working properly:
REPL does not throw if you remove
exports
frompackage.json
, though this is unfavored.Additional information
Context: babel/babel#11878
Maybe related: #32935 But IMO adding
exports
should not break the ability of requiring a commonjs module in REPL./cc @guybedford
The text was updated successfully, but these errors were encountered: