Skip to content

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

// @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
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.

3 participants