Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/nuxtPublic

refactor(nuxt): move custom impl of vite warmup to vite config#33390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
huang-julien wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromrefactor/vite_warmup_entry

Conversation

huang-julien
Copy link
Member

🔗 Linked issue

📚 Description

This PR moves our vite warmup implementation tovite.server.warmup. There's a catch though, we lose logs about how long it took to warmup.

@bolt-new-by-stackblitzBolt.new (by StackBlitz)
Copy link

Review PR in StackBlitz CodeflowRun & review this pull request inStackBlitz Codeflow.

@danielroe
Copy link
Member

does it work? when I last checked it did not correctly warm up the server

@coderabbitaicoderabbitai
Copy link

Walkthrough

  • Added vite.server.warmup to the public config schema with ssrFiles and clientFiles, each having a $resolve that returns the provided value or falls back to [vite.entry] if vite.warmupEntry exists, else [].
  • Removed the custom warmup utility warmupViteServer and all related helpers/imports from packages/vite/src/utils/warmup.ts.
  • Updated packages/vite/src/vite.ts to drop warmupViteServer usage/import and rely on Vite’s server.warmup configuration to warm SSR and client entries, disabling the previous compiled-hook warmup path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check nameStatusExplanation
Title Check✅ PassedThe pull request title accurately describes the primary change of refactoring the custom Vite warmup implementation into the Vite configuration for Nuxt, using clear and specific language and following the conventional commit style to convey the main intent of the changeset.
Description Check✅ PassedThe pull request description clearly outlines that the custom Vite warmup implementation has been moved to the Vite server configuration and notes the consequence of losing timing logs, making it directly relevant to the changeset.
Docstring Coverage✅ PassedNo functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branchrefactor/vite_warmup_entry

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment@coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitaicoderabbitaibot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/schema/src/config/vite.ts (1)

122-137:Consider extracting duplicate resolver logic.

The resolver logic is identical for bothssrFiles andclientFiles. Whilst this duplication is minor, extracting it to a helper function would improve maintainability.

Example refactor:

constresolveWarmupFiles=async(val:any,get:(key:string)=>Promise<any>)=>{if(val){returnval}return(awaitget('vite.warmupEntry')) ?[awaitget('vite.entry')] :[]}// Then use:warmup:{ssrFiles:{$resolve:resolveWarmupFiles,},clientFiles:{$resolve:resolveWarmupFiles,},},
packages/vite/src/vite.ts (1)

154-158:server.warmup hardcodes override schema defaults

  • Explicit ssrFiles/clientFiles inpackages/vite/src/vite.ts (lines 154–158) bypass the schema resolver inpackages/schema/src/config/vite.ts (lines 127/135), which honoursnuxt.options.vite.warmupEntry.
  • Use a conditional based onnuxt.options.vite.warmupEntry or remove the explicit arrays to defer to the schema’s logic.
  • Warmup timing logs were dropped—consider re-adding observability via a Vite plugin or hook.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and betweend6df732 and781655e.

📒 Files selected for processing (3)
  • packages/schema/src/config/vite.ts (1 hunks)
  • packages/vite/src/utils/warmup.ts (0 hunks)
  • packages/vite/src/vite.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/vite/src/utils/warmup.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/vite/src/vite.ts
  • packages/schema/src/config/vite.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: code
🔇 Additional comments (1)
packages/schema/src/config/vite.ts (1)

127-127:No action needed:vite.warmupEntry is defined in packages/schema/src/types/config.ts (line 114) as an optional boolean.

@huang-julienhuang-julien marked this pull request as draftOctober 3, 2025 21:38
@huang-julien
Copy link
MemberAuthor

@danielroe It seems so. the warmup request do get triggered throughwarmupFiles ->warmupFile ->warmupRequest ->transformRequest
image

How would you verify it ?

@danielroe
Copy link
Member

I test it by measuring the time after the dev server is ready and timing the initial browser load ofhttp://localhost:3000. try:

  1. with no warmup
  2. with the current implementation
  3. with this PR

ideally you should see a significant difference between 1 & 2, and no difference between 2 & 3 (or a speedup).

@huang-julien
Copy link
MemberAuthor

Well I see no differences between no warmup, this PR and the current implementation using nuxt.com
Maybe due to being on windows ?? I'll try again thorugh WSL

allow:[...newSet(allowDirs)],
},
warmup:{
ssrFiles:[entry],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

we already do this:

see#27963

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

yes but I removed it when testing it. I currently have some issues with WSL, will try again later

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I mean, I'm not sure this PR changes anything as we already use the vite native warmup (we just set it in a different file)

huang-julien reacted with thumbs up emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@danielroedanielroedanielroe left review comments

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@huang-julien@danielroe

[8]ページ先頭

©2009-2025 Movatter.jp