Skip to content

Conversation

@marcalexiei
Copy link
Contributor

Fixes #656

To prevent the reintroduction of #615,
I refined the condition in package.json to return the default export only if it is the only available export.
Otherwise, the module will be returned as-is, which should resolve #656.


Note

Since this package supports relatively recent versions of Node:

"engines": {
"node": "^18.18.0 || ^20.9.0 || >=22.0.0"
},

the entire function could potentially be refactored in the future to primarily use an dynamic import instead of require.
For reference: Node's import support status.

Let me know if it's something you're interested in exploring!

@marcalexiei marcalexiei marked this pull request as ready for review March 15, 2025 16:37
@bmish bmish added the bug Something isn't working label Mar 16, 2025
Copy link
Owner

@bmish bmish left a comment

Choose a reason for hiding this comment

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

Thanks.

Ideally we can add some tests for this in the near future, although I know it's kind of annoying to test.

@bmish bmish changed the title fix(package-json): refine ESM logic to return default export only when it is the only available export Fix regression in ESM plugin loading Mar 16, 2025
@bmish bmish merged commit d194eae into bmish:main Mar 16, 2025
8 checks passed
@bmish
Copy link
Owner

bmish commented Mar 16, 2025

@marcalexiei yes I'd love if there was a way to simplify this logic or make it more robust. Loading the plugin is quite painful right now. Feel free to experiment with improvements.

@marcalexiei marcalexiei deleted the consider-plugin-using-additional-exrpots branch March 16, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: configuration details are being dropped in the latest version (2.1.1)

2 participants