summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-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) {