Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] string_decoder/ is not builtin #7

Closed
loynoir opened this issue Jul 27, 2021 · 2 comments · Fixed by #13
Closed

[bug] string_decoder/ is not builtin #7

loynoir opened this issue Jul 27, 2021 · 2 comments · Fixed by #13

Comments

@loynoir
Copy link

loynoir commented Jul 27, 2021

CJS & ESM

CJS and ESM both think string_decoder/ is external

> require('string_decoder/')
Uncaught Error: Cannot find module 'string_decoder/'
> await import('string_decoder/')
Uncaught:
Error [ERR_MODULE_NOT_FOUND]:

Actual

> isBuiltinModule = require('is-builtin-module');
> isBuiltinModule('string_decoder/')
true

Expected

> isBuiltinModule = require('is-builtin-module');
> isBuiltinModule('string_decoder/')
false

Related

> isBuiltinModule('string_decoder')
true
> isBuiltinModule('fs/promises')
true
@sindresorhus
Copy link
Owner

When sindresorhus/builtin-modules#12 is fixed, we can remove

const slashIndex = moduleName.indexOf('/');
if (slashIndex !== -1) {
moduleName = moduleName.slice(0, slashIndex);
}
and this issue will be fixed.

@papb
Copy link

papb commented Oct 13, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants