Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support warmup by IDs #16447

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

KermanX
Copy link

@KermanX KermanX commented Apr 18, 2024

Description

This PR implements the server.warmup.clientIds and server.warmup.ssrIds options, which are the IDs of modules to be warmed up. For example, ['virtual:custom'].

Slidev's starting time is a little bit too long now, and to improve this, virtual modules like /@slidev/slides/3.md should be warmed up. Currently, Vite's server.warmup.clientFiles only accepts files, and there seem to be no other ways.

I am not 100% sure about the naming conventions in Vite. Should the option be clientIds or clientUrls?

Copy link

stackblitz bot commented Apr 18, 2024

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

@KermanX KermanX changed the title feat: support warmup by URLs feat: support warmup by IDs Apr 18, 2024
@patak-dev
Copy link
Member

I think we should go with url here. It feels a bit too much to have both clientFiles and clientUrls though. I wonder if we could keep only the urls somehow, making the patterns work. So it also better aligns with server.warmupRequest(url)

In Vite 6, we'll have an opportunity to review this API because we are moving it a dev environment config option. Currently it is:

export default defineConfig({
  environments: {
    client: {
      dev: {
        warmup: [files...]
      }
    }
  }
})

So we can directly define that warmup are URLs. Or switch to an object if we need that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants