chore: Silence warnings when using 'node:' protocol by rschristian · Pull Request #956 · developit/microbundle · GitHub
Skip to content

chore: Silence warnings when using 'node:' protocol#956

Merged
developit merged 2 commits intomasterfrom
chore/silence-node-protocol-warnings
May 4, 2022
Merged

chore: Silence warnings when using 'node:' protocol#956
developit merged 2 commits intomasterfrom
chore/silence-node-protocol-warnings

Conversation

@rschristian
Copy link
Copy Markdown
Collaborator

The current solution for matching builtins doesn't catch imports using the new-ish node: protocol:

Failed to resolve the module node:http imported by src/index.js
Is the module installed? Note:
 ↳ to inline a module into your bundle, install it to "devDependencies".
 ↳ to depend on a module via import/require, install it to "dependencies".

This just adds it to the patterns to match against when the target for Microbundle is Node.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2022

Comment thread src/index.js
// @see https://github.com/rollup/plugins/tree/master/packages/node-resolve/#resolving-built-ins-like-fs
if (options.target === 'node') {
external = external.concat(builtinModules);
external = [/node:.*/].concat(builtinModules);
Copy link
Copy Markdown
Collaborator Author

@rschristian rschristian May 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I purposefully replaced external here as otherwise we get duplicates.

@developit developit merged commit 6018e58 into master May 4, 2022
@developit developit deleted the chore/silence-node-protocol-warnings branch May 4, 2022 23:40
@preact-bot preact-bot mentioned this pull request May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants