Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Merged
merged 2 commits into from
May 4, 2022

Conversation

rschristian
Copy link
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

changeset-bot bot commented May 4, 2022

🦋 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
Name Type
microbundle Patch

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

@@ -347,7 +347,7 @@ function createConfig(options, entry, format, writeMeta) {
// We want to silence rollup warnings for node builtins as we rollup-node-resolve threats them as externals anyway
// @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
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.

let external = ['dns', 'fs', 'path', 'url'];

@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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants