summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2023-09-04 03:11:47 -0500
committerGravatar GitHub <noreply@github.com> 2023-09-04 09:11:47 +0100
commit362491b8da33317c9a1116fbd5a648184b9b3c7f (patch)
treed7d5bd003131683aaad8bb63d637c9d199479bb4
parent8d12659ce88460b2af00a6752feb7fcca9ac9bf3 (diff)
downloadastro-362491b8da33317c9a1116fbd5a648184b9b3c7f.tar.gz
astro-362491b8da33317c9a1116fbd5a648184b9b3c7f.tar.zst
astro-362491b8da33317c9a1116fbd5a648184b9b3c7f.zip
Fix pipeline `beforeHydrationScript` handling (#8388)
-rw-r--r--.changeset/hot-colts-call.md5
-rw-r--r--packages/astro/src/core/build/buildPipeline.ts2
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/hot-colts-call.md b/.changeset/hot-colts-call.md
new file mode 100644
index 000000000..00c22a708
--- /dev/null
+++ b/.changeset/hot-colts-call.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Properly handle `BEFORE_HYDRATION_SCRIPT` generation, fixing MIME type error on hydration.
diff --git a/packages/astro/src/core/build/buildPipeline.ts b/packages/astro/src/core/build/buildPipeline.ts
index ba1bfad0e..bdf9c7706 100644
--- a/packages/astro/src/core/build/buildPipeline.ts
+++ b/packages/astro/src/core/build/buildPipeline.ts
@@ -36,7 +36,7 @@ export class BuildPipeline extends Pipeline {
compressHTML: manifest.compressHTML,
async resolve(specifier: string) {
const hashedFilePath = manifest.entryModules[specifier];
- if (typeof hashedFilePath !== 'string') {
+ if (typeof hashedFilePath !== 'string' || hashedFilePath === '') {
// If no "astro:scripts/before-hydration.js" script exists in the build,
// then we can assume that no before-hydration scripts are needed.
if (specifier === BEFORE_HYDRATION_SCRIPT_ID) {