Skip to content

feat(register): respect -C/--conditions flags in ESM #943

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nicknovitski
Copy link

This fixes #890, and my usage. I think every package using subpath imports in package.json instead paths rewriting in .swcrc will need to use conditions, and therefore will need this change to support switching to ESM.

The get-conditions package parses process.argv and process.env.NODE_OPTIONS, and also adds "node", and, if --no-addons hasn't been set, "node-options".

@CLAassistant
Copy link

CLAassistant commented Jun 16, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedget-conditions@​1.0.0571008076100

View full report

@nicknovitski
Copy link
Author

If it's preferable I can implement that logic instead of adding the dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[@swc-node/register] passing flag --condition (-C) to node with esm-register import has no effect
2 participants