From c7bbb1128936207164cb5ac0c0ad9b1af86d861e Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Tue, 1 Mar 2022 08:13:39 -0600 Subject: [PATCH] fix: disable HMR during build (#2684) --- .changeset/wet-knives-raise.md | 5 +++++ packages/astro/src/vite-plugin-astro/index.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/wet-knives-raise.md diff --git a/.changeset/wet-knives-raise.md b/.changeset/wet-knives-raise.md new file mode 100644 index 000000000..9a0b1acc2 --- /dev/null +++ b/.changeset/wet-knives-raise.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix issue where HMR could be triggered during `astro build` diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index 3165c8786..4b74e1060 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -204,6 +204,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu } }, async handleHotUpdate(context) { + if (context.server.config.isProduction) return; return handleHotUpdate(context, config, logging); }, };