Skip to content

Commit

Permalink
fix: explicitly call import.meta.hot.decline()
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Jul 21, 2022
1 parent 4aa7f32 commit 188120b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/astro/src/vite-plugin-astro/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu
SUFFIX += `\nimport "${PAGE_SSR_SCRIPT_ID}";`;
}

// Prefer live reload to HMR in `.astro` files
if (!resolvedConfig.isProduction) {
SUFFIX += `\nif (import.meta.hot) { import.meta.hot.decline() }`;
}

const astroMetadata: AstroPluginMetadata['astro'] = {
clientOnlyComponents: transformResult.clientOnlyComponents,
hydratedComponents: transformResult.hydratedComponents,
Expand Down

0 comments on commit 188120b

Please sign in to comment.