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

fix(nuxt): transform #components imports into direct component imports #20547

Merged
merged 7 commits into from Apr 28, 2023

Conversation

antfu
Copy link
Member

@antfu antfu commented Apr 27, 2023

πŸ”— Linked issue

closes #20492 (as a better fix)

resolves #20439
resolves #20450
resolves #20449

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 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)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

With #20259, it becomes more difficult for rollup to tree-shake out unused components, and side effects were persisting in the entry file. This change transforms imports from #components into individual imports of each component, meaning that there should be no possibility of side-effects from unused components.

πŸ“ Checklist

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

@codesandbox
Copy link

codesandbox bot commented Apr 27, 2023

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@antfu
Copy link
Member Author

antfu commented Apr 27, 2023

/cc @danielroe do you remember what was componentNames introduced for? Should we keep supporting it?

@danielroe
Copy link
Member

I think we introduced componentNames in nuxt/framework#4150, with the idea that it might be used by a preview mode/editor/overlay that needed to know what was available. Ideally we'd keep supporting it; it could be another virtual module that would be tree-shaken if not used.

@danielroe danielroe changed the title feat(nuxt): compile time #components fix(nuxt): transform #components imports into direct component imports Apr 27, 2023
@danielroe danielroe merged commit 98b20c4 into main Apr 28, 2023
17 checks passed
@danielroe danielroe deleted the feat/unimport-components branch April 28, 2023 09:14
This was referenced Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants