Skip to content

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

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

chore: Silence warnings when using 'node:' protocol#956
developit merged 2 commits into
masterfrom
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 detected

Latest commit: b70d7d0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
microbundlePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment threadsrc/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);

@rschristianrschristianMay 4, 2022

Copy link
Copy Markdown
CollaboratorAuthor

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.

letexternal=['dns','fs','path','url'];

@developit
developit merged commit 6018e58 into masterMay 4, 2022
@developit
developit deleted the chore/silence-node-protocol-warnings branch May 4, 2022 23:40
@preact-botpreact-bot mentioned this pull request May 4, 2022
Sign up for freeto 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

@rschristian@developit