Skip to content

Conversation

@austinw-fineart
Copy link

@austinw-fineart austinw-fineart commented Jun 25, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: fixes #201

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@shaharkazaz
Copy link
Collaborator

@austinw-fineart Hey! Can you elaborate on how this will fix the CJS/ESM issue you referred to?

@austinw-fineart
Copy link
Author

See: https://nodejs.org/api/packages.html#conditional-exports
Adding the "default" fallback allows the package to be imported by CJS. This is needed for NX compatibility because it uses a CJS resolver in its tooling which prevents ESM-only plugins from being resolved. While you could consider this to be an NX-specific bug, nothing prevents ESM in CJS apart from this artificial limitation and adding the "default" fallback only expands this package's compatibility. I did keep the explicit "import" even if it's redundant here. I also moved "types" up because it should be first; yes the order matters.

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.

Bug: Unable to import TranslocoExtractKeysWebpackPlugin

2 participants