Skip to content

perf(nuxt): use granular imports for auto-importing composables#23951

Merged
danielroe merged 12 commits intomainfrom
perf/granular-presets
Oct 30, 2023
Merged

perf(nuxt): use granular imports for auto-importing composables#23951
danielroe merged 12 commits intomainfrom
perf/granular-presets

Conversation

@danielroe
Copy link
Copy Markdown
Member

🔗 Linked issue

❓ 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

This PR aims to improve Vite HMR + cold start/warmup performance by reducing crawling of unneeded files in the nuxt app:

  1. within nuxt app, we now entirely use relative paths to import composables only from the file exporting them rather than from the entrypoint
  2. within user projects, we now auto-import directly from the file within nuxt app rather than from the entrypoint (#app)

📝 Checklist

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

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@nuxt-studio
Copy link
Copy Markdown
Contributor

nuxt-studio bot commented Oct 27, 2023

Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio ↗︎ View Live Preview 4b9f5f0

josecelano added a commit to torrust/torrust-index-gui that referenced this pull request Nov 8, 2023
21787f9 fix: import nuxt composables from #imports (Daniel Roe)

Pull request description:

  This is a DX improvement when developing - we can avoid loading the entire barrel file at `#app` by using the new granular imports merged in nuxt/nuxt#23951.

ACKs for top commit:
  josecelano:
    ACK 21787f9

Tree-SHA512: a238f9a80e7be8b3a54b9b4637c4371e1b81fb507aa9a20cca5b9344f5dfe4b886588bfc7f22cdd74b30a391a661d4221cc9915bfc1ebe9eba61c24d8a08216a
@TheAlexLichter
Copy link
Copy Markdown
Member

@danielroe Is really on a roll providing PRs to all the public repos that will benefit from that change. Amazing job 👏🏻

@danielroe
Copy link
Copy Markdown
Member Author

❤️

This was referenced Nov 8, 2023
fbjork added a commit to grafbase/grafbase that referenced this pull request Nov 8, 2023
# Description

Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.

# Type of change

- [ ] 💔 Breaking
- [ ] 🚀 Feature
- [x] 🐛 Fix
- [ ] 🛠️ Tooling
- [ ] 🔨 Refactoring
- [ ] 🧪 Test
- [ ] 📦 Dependency
- [ ] 📖 Requires documentation update

This is a DX improvement when developing - we can avoid loading the
entire barrel file at `#app` by using the new granular imports merged in
nuxt/nuxt#23951.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants