Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(bridge): Recognize {... as default } construction in vite plugin #1769

Closed
wants to merge 1 commit into from

Conversation

tobiasdiez
Copy link
Contributor

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Currently, the construction export { xyz as default } is not recognized as a valid default export by the default-export vite plugin. Thus, a second default export is added, which leads to an error.
An example is
https://github.com/posva/pinia/blob/a76e34387419e86154a63985ad038eefeb2bc9fd/packages/nuxt/src/templates/plugin.ts#L50
which is transpiled as export { PiniaNuxtPlugin as default }; in the distributed build. (cc @posva)

This is fixed by adding a regex-based check.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@netlify
Copy link

netlify bot commented Nov 7, 2021

βœ”οΈ Deploy Preview for nuxt3-docs canceled.

πŸ”¨ Explore the source changes: d30170e

πŸ” Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/618835d4bb060c00089a9c9f

@tobiasdiez tobiasdiez mentioned this pull request Nov 7, 2021
38 tasks
@pi0
Copy link
Member

pi0 commented Nov 9, 2021

Thanks for pull request @tobiasdiez. An alternative solution merged to use mlly utils. See #1774

@pi0 pi0 closed this Nov 9, 2021
@tobiasdiez tobiasdiez deleted the patch-1 branch November 9, 2021 09:36
@tobiasdiez
Copy link
Contributor Author

Yes, that looks like a cleaner solution indeed!

@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants