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

fix(vite): improve warmup - #4106

Merged
pi0 merged 1 commit into
mainfrom
fix/warm-up
Apr 6, 2022
Merged

fix(vite): improve warmup#4106
pi0 merged 1 commit into
mainfrom
fix/warm-up

Conversation

@antfu

@antfuantfu commented Apr 5, 2022

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

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

@antfuantfu changed the title fix(vite): warm upfix(vite): warm up improvementApr 5, 2022
@netlify

netlifyBot commented Apr 5, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commit383286d
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/624cb5c929fe0a0008867e8c

pi0
pi0 approved these changes Apr 6, 2022
@pi0pi0 changed the title fix(vite): warm up improvementfix(vite): improve warmupApr 6, 2022
@pi0
pi0 merged commit ec32cf9 into mainApr 6, 2022
@pi0
pi0 deleted the fix/warm-up branch April 6, 2022 05:54
Sign up for freeto 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

@antfu@pi0@danielroe