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

fix(vite): improve warmup #4106

Merged
merged 1 commit into from
Apr 6, 2022
Merged

fix(vite): improve warmup #4106

merged 1 commit into from
Apr 6, 2022

Conversation

antfu
Copy link
Member

@antfu antfu commented Apr 5, 2022

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

The original warm-up will only warm up the entry module, due to two issues:

  • server.moduleGraph.urlToModuleMap.get(url) does not hit because we are warm-up with unresolved URLs, while urlToModuleMap stores resolved absolute URL. Use getModuleByUrl(url) will let Vite handles the normalization and matching.
  • Since the introduction of VFS for internal modules, the URL gets appended with /@id/__x00__ for browser compatibility, while the plugin still expects the id starts with \0, causing the transformRequest to return undefined and failed to identify it's dependencies (that means, all Vue components and user code)

This PR improves the warm-up logic, and also fixes the FOUC problem of vite-node and #3968

@antfu antfu changed the title fix(vite): warm up fix(vite): warm up improvement Apr 5, 2022
@netlify
Copy link

netlify bot commented Apr 5, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit 383286d
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/624cb5c929fe0a0008867e8c

@pi0 pi0 changed the title fix(vite): warm up improvement fix(vite): improve warmup Apr 6, 2022
@pi0 pi0 merged commit ec32cf9 into main Apr 6, 2022
@pi0 pi0 deleted the fix/warm-up branch April 6, 2022 05:54
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants