Skip to content
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

chore(node-resolve): remove is-builtin-module #1735

Merged
merged 1 commit into from
Sep 22, 2024
Merged

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Jun 7, 2024

Node has shipped builtinModules for some time now, so we no longer need a third party package to do this.

Once the engines constraint is bumped in the package.json, we can also move to using the built-in isBuiltin function (available since 16.x).

Rollup Plugin Name: node-resolve

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no (existing tests should cover it)

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

Copy link
Member

@tjenkinson tjenkinson left a comment

Choose a reason for hiding this comment

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

Great that this is built in now TIL

Makes sense if we're not supporting <16

packages/node-resolve/src/index.js Outdated Show resolved Hide resolved
@43081j
Copy link
Contributor Author

43081j commented Jun 7, 2024

FYI the engine constraint in here actually specifies 14 or something. Which is why I have used the built in modules list (available in 14), but not isBuiltin (available in 16)

Just to be clear

If we can bump the engine constraint to 16, we could use the built in function

Node has shipped `builtinModules` for some time now, so we no longer
need a third party package to do this.

Once the `engines` constraint is bumped in the `package.json`, we can
also move to using the built-in `isBuiltin` function (available since
16.x).
Copy link
Member

@tjenkinson tjenkinson left a comment

Choose a reason for hiding this comment

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

Lgtm!

@43081j
Copy link
Contributor Author

43081j commented Jun 18, 2024

any chance we can get this merged? 👀

would be a good to pull it into a few dependents

Copy link
Contributor

@benmccann benmccann left a comment

Choose a reason for hiding this comment

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

lgtm

import isBuiltinModule from 'is-builtin-module';
import { builtinModules } from 'module';

Choose a reason for hiding this comment

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

Won't this cause a behavior change if you're bundling on one version of node, but a newer node has that module available? Or does it not matter because node will never add any new module without the node: prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's unlikely they will add any new modules without the prefix as far as I understand

Also the third party package also has a fixed list which won't always be accurate to the runtime node

@43081j
Copy link
Contributor Author

43081j commented Aug 29, 2024

@shellscape any chance you can take a look at this? would be good to close it off

@43081j
Copy link
Contributor Author

43081j commented Sep 7, 2024

any possibility of a review from someone here? would be super nice to merge this so it doesn't get left behind

@shellscape shellscape merged commit 190aa21 into rollup:master Sep 22, 2024
5 checks passed
@shellscape
Copy link
Collaborator

thanks!

@43081j 43081j deleted the ibm branch September 23, 2024 03:18
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.

7 participants