Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

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

Merged
pi0 merged 3 commits into
mainfrom
refactor/relative-composable-imports
Sep 14, 2022
Merged

refactor(nuxt): use relative imports into composables#7487
pi0 merged 3 commits into
mainfrom
refactor/relative-composable-imports

Conversation

@danielroe

Copy link
Copy Markdown
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.

@danielroedanielroe 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 pi0September 13, 2022 22:46
@danielroedanielroe self-assigned this Sep 13, 2022
@netlify

netlifyBot commented Sep 13, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commiteec511b
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/63210b01f766850008b089ca

pi0
pi0 approved these changes Sep 14, 2022
@pi0

pi0 commented Sep 14, 2022

Copy link
Copy Markdown
Member

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 mainSep 14, 2022
@pi0
pi0 deleted the refactor/relative-composable-imports branch September 14, 2022 09:22
This was referenced Sep 14, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xchore🍰 p2-nice-to-havePriority 2: nothing is broken but it's worth addressing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@danielroe@pi0