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

refactor(nuxt): use relative imports into composables #7487

Merged
merged 3 commits into from Sep 14, 2022

Conversation

danielroe
Copy link
Member

πŸ”— 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

I came a significant performance hit (in Nuxt Bridge) from importing from #app alias with vite, because #app re-exports lots of files which themselves import from #app.

We can work around that by using relative imports, which I think is also slightly nicer. Even though I haven't measured a slow-down in this repo, it can't hurt and should be a more intelligible approach for vite. I've left a number of imports from #app untouched within plugins/components as these are not re-exported from #app. (It might also be possible to do the same with head, but it's still in a quasi-independent state and this can wait for improvements to its implementation.

πŸ“ Checklist

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

@danielroe danielroe added chore 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Sep 13, 2022
@danielroe danielroe requested a review from pi0 September 13, 2022 22:46
@danielroe danielroe self-assigned this Sep 13, 2022
@netlify
Copy link

netlify bot commented Sep 13, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit eec511b
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/63210b01f766850008b089ca

@pi0
Copy link
Member

pi0 commented Sep 14, 2022

I don't think it should significantly affect performance unless something is wrong with the intermediate resolver cache. Also entrypoint of app is anyway finally imported. But using relative import paths when possible seems more readable and if it is helping performance, why not :)

@pi0 pi0 merged commit ee75b48 into main Sep 14, 2022
@pi0 pi0 deleted the refactor/relative-composable-imports branch September 14, 2022 09:22
This was referenced Sep 14, 2022
@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
3.x chore 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants