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

Add named exports to build files #3644

Merged
merged 3 commits into from
Jan 21, 2024

Conversation

ypconstante
Copy link
Contributor

Like discussed on #3637, Node handles default export differently from other tools, causing the imported object to be wrapped in another object with a default key.

This PR adds named export to all packages, allowing imports that work with both import interpretations.
For plugins the exported name has a Plugin suffix, since @alpinejs/morph already has a export named only morph.

This solution is the recommendation from esbuild.

@calebporzio
Copy link
Collaborator

This makes sense, however can you rename the exports back to their single-word name? So "collapse" instead of "collapsePlugin"? I'll merge this if you do that. Thanks

@ypconstante ypconstante force-pushed the build-named-exports branch 3 times, most recently from 83398f1 to 78dc417 Compare July 24, 2023 15:37
@ypconstante
Copy link
Contributor Author

Removed Plugin suffix

@@ -1,5 +1,5 @@
import morphPlugin, { morph } from '../src/index.js'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think these are two separate exports and should remain that way.

But now I see that this would mean this plugin diverges from the rest of the named plugin exports.

Hmmmm.... the "morphPlugin" variable is actually the plugin, and "morph" is the morphing function, not the full plugin.

So this change would cause a breakage for other people consuming { morph }

It's not documented so I'm not sure how much of a breaking change it would be, but it at least will probably break something internally? or with Livewire?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just found at least one usage of this. Jest tests are using this export.

Are this tests still used? They are not running on CI, and currently are failing.

@calebporzio calebporzio merged commit aed412b into alpinejs:main Jan 21, 2024
1 check failed
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.

None yet

2 participants