framework
framework copied to clipboard
perf(vite): remove vite warm up
🔗 Linked issue
❓ Type of change
- [ ] 📖 Documentation (updates to the documentation or readme)
- [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
- [x] 👌 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
This reduces the start-up time of nuxt.com repo with viteNode: true (nuxi dev to first render on the browser)
from 60s to 40s on my M1 Max Macbook Pro.
Reasoning:
- Vite will now do warm-up for sync deps automatically.
- Our warm-up uses
server.transformRequest(url)for both client/server. Where the server bundler actually needsserver.transformRequest(url, { ssr: true }), which is actually using a different plugin pipeline and caches.
📝 Checklist
- [ ] I have linked an issue or discussion.
- [ ] I have updated the documentation accordingly.
Deploy Preview for nuxt3-docs canceled.
| Name | Link |
|---|---|
| Latest commit | f0a73115c5c3d544d0fadedc6a8c591610d23a9f |
| Latest deploy log | https://app.netlify.com/sites/nuxt3-docs/deploys/62fa622147e8880008a4a2e5 |
Vite will now do warm-up for sync deps automatically.
Does Vite also warmups the entrypoint in background? (Same for vite-node with ssr condition)
Our warm-up uses server.transformRequest(url) for both client/server. Where the server bundler actually needs server.transformRequest(url, { ssr: true }), which is actually using a different plugin pipeline and caches.
Nice find and probably to late to fix if warmup is not relevant anymore 😅
I also tried to only warm up the entry (and let Vite crawl the deps), it ends up around 50s start-up time. I guess it might be because it occupied the execution time of other parts. I could do a more detailed benchmarking, and probably try delaying the warm-up with a timeout.
I suggest this method to benchmark:
- Cleanup cache with
nuxi cleanupeach time - In parallel initiate a fetch to
http://localhost:300and startnuxi dev- Measure time to first byte for SSR perf
- Open a new browser window ensuring no other windows are open
- Measure time to load for entrypoint scripts
Let's experiment this as an option that we can disable. (sorry there were merge conflicts otherwise would push to same PR) ~> #6647.
We should also track this:
Our warm-up uses server.transformRequest(url) for both client/server. Where the server bundler actually needs server.transformRequest(url, { ssr: true }), which is actually using a different plugin pipeline and caches.
~> #6649