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

fix: make is-builtin-module also support CJS + work with non-standard names #42

Merged
merged 1 commit into from
Jul 21, 2024

Conversation

MeLlamoPablo
Copy link
Contributor

This PR fixes two issues in the is-builtin-module codemod:

  1. It doesn't work with non-standard import names. If you imported it like this:

    import banana from 'is-builtin-module';

    The codemod would replace it with:

    import { isBuiltin } from "node:module";

    But it wouldn't update the usages of the package, staying as banana. I've added a fixture under case-2 to handle this.

  2. It doesn't work with CJS. If used with a require call it would simply do nothing.

    I've added a fixture under case-3 to test that.

Note: I'm facing an issue here, see my comment below 👇

@MeLlamoPablo MeLlamoPablo force-pushed the fix/is-builtin-module branch from 8ebaaea to 1c70b2e Compare July 21, 2024 15:45
@thepassle thepassle merged commit 5d735fe into es-tooling:main Jul 21, 2024
3 checks passed
@MeLlamoPablo MeLlamoPablo deleted the fix/is-builtin-module branch July 31, 2024 15:52
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