Skip to content

feat(nuxt): ensure prefetchComponents be treeshake on server#27905

Merged
danielroe merged 1 commit intonuxt:mainfrom
Mini-ghost:feat/treeshake-prefetchComponents
Jun 29, 2024
Merged

feat(nuxt): ensure prefetchComponents be treeshake on server#27905
danielroe merged 1 commit intonuxt:mainfrom
Mini-ghost:feat/treeshake-prefetchComponents

Conversation

@Mini-ghost
Copy link
Copy Markdown
Member

🔗 Linked issue

N/A

📚 Description

Before

export const prefetchComponents = (components: string | string[]) => {
  return preloadComponents(components)
}
Before

prefetchComponents and preloadComponents are both not tree shaken on the server side.

After

export const prefetchComponents = (components: string | string[]) => {
  if (import.meta.server) { return }
  return preloadComponents(components)
}
After

prefetchComponents and preloadComponents are both tree shaken on the server side.

@Mini-ghost Mini-ghost requested a review from danielroe as a code owner June 28, 2024 17:42
@bolt-new-by-stackblitz
Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants