-
Notifications
You must be signed in to change notification settings - Fork 191
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
Support node:http
etc.
#303
Comments
We already supports this in webpack, what do you mean? |
When using enhanced-resolve, it tries to locate the 'http' package but it should be ignored because it's a built-in. But maybe this is out of scope for this package. |
If require.resolve does it, it's not out of scope. |
My solution to this is to use the alias option, with the This was particularly useful for the usecase in #310 where I could not just check the import before hand! My alias list is: const alias = [
{ name: 'assert', alias: false },
{ name: 'assert/strict', alias: false },
{ name: 'async_hooks', alias: false },
{ name: 'buffer', alias: false },
{ name: 'child_process', alias: false },
{ name: 'cluster', alias: false },
{ name: 'console', alias: false },
{ name: 'crypto', alias: false },
{ name: 'dgram', alias: false },
{ name: 'diagnostics_channel', alias: false },
{ name: 'dns', alias: false },
{ name: 'dns/promises', alias: false },
{ name: 'domain', alias: false },
{ name: 'events', alias: false },
{ name: 'fs', alias: false },
{ name: 'fs/promises', alias: false },
{ name: 'http', alias: false },
{ name: 'http2', alias: false },
{ name: 'inspector', alias: false },
{ name: 'inspector/promises', alias: false },
{ name: 'module', alias: false },
{ name: 'net', alias: false },
{ name: 'os', alias: false },
{ name: 'path', alias: false },
{ name: 'path/posix', alias: false },
{ name: 'path/win32', alias: false },
{ name: 'perf_hooks', alias: false },
{ name: 'process', alias: false },
{ name: 'punycode', alias: false },
{ name: 'querystring', alias: false },
{ name: 'readline', alias: false },
{ name: 'readline/promises', alias: false },
{ name: 'repl', alias: false },
{ name: 'stream', alias: false },
{ name: 'stream/consumers', alias: false },
{ name: 'stream/promises', alias: false },
{ name: 'stream/web', alias: false },
{ name: 'string_decoder', alias: false },
{ name: 'timers', alias: false },
{ name: 'timers/promises', alias: false },
{ name: 'tls', alias: false },
{ name: 'trace_events', alias: false },
{ name: 'tty', alias: false },
{ name: 'url', alias: false },
{ name: 'util', alias: false },
{ name: 'util/types', alias: false },
{ name: 'v8', alias: false },
{ name: 'vm', alias: false },
{ name: 'wasi', alias: false },
{ name: 'worker_threads', alias: false },
{ name: 'zlib', alias: false },
{ name: 'node:assert', alias: false },
{ name: 'node:assert/strict', alias: false },
{ name: 'node:async_hooks', alias: false },
{ name: 'node:buffer', alias: false },
{ name: 'node:child_process', alias: false },
{ name: 'node:cluster', alias: false },
{ name: 'node:console', alias: false },
{ name: 'node:crypto', alias: false },
{ name: 'node:dgram', alias: false },
{ name: 'node:diagnostics_channel', alias: false },
{ name: 'node:dns', alias: false },
{ name: 'node:dns/promises', alias: false },
{ name: 'node:events', alias: false },
{ name: 'node:fs', alias: false },
{ name: 'node:fs/promises', alias: false },
{ name: 'node:http', alias: false },
{ name: 'node:http2', alias: false },
{ name: 'node:inspector', alias: false },
{ name: 'node:inspector/promises', alias: false },
{ name: 'node:module', alias: false },
{ name: 'node:net', alias: false },
{ name: 'node:os', alias: false },
{ name: 'node:path', alias: false },
{ name: 'node:path/posix', alias: false },
{ name: 'node:path/win32', alias: false },
{ name: 'node:perf_hooks', alias: false },
{ name: 'node:process', alias: false },
{ name: 'node:querystring', alias: false },
{ name: 'node:readline', alias: false },
{ name: 'node:readline/promises', alias: false },
{ name: 'node:repl', alias: false },
{ name: 'node:sea', alias: false },
{ name: 'node:stream', alias: false },
{ name: 'node:stream/consumers', alias: false },
{ name: 'node:stream/promises', alias: false },
{ name: 'node:stream/web', alias: false },
{ name: 'node:string_decoder', alias: false },
{ name: 'node:test', alias: false },
{ name: 'node:timers', alias: false },
{ name: 'node:timers/promises', alias: false },
{ name: 'node:tls', alias: false },
{ name: 'node:trace_events', alias: false },
{ name: 'node:tty', alias: false },
{ name: 'node:url', alias: false },
{ name: 'node:util', alias: false },
{ name: 'node:util/types', alias: false },
{ name: 'node:v8', alias: false },
{ name: 'node:vm', alias: false },
{ name: 'node:wasi', alias: false },
{ name: 'node:worker_threads', alias: false },
{ name: 'node:zlib', alias: false },
]; |
https://nodejs.org/api/esm.html#esm_node_imports
Workaround
https://github.com/sindresorhus/is-builtin-module
The text was updated successfully, but these errors were encountered: