Merge branch 'main' into main

This commit is contained in:
Chris 2023-09-04 10:33:15 +02:00 committed by GitHub
commit a8d0e77d64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Properly handle `BEFORE_HYDRATION_SCRIPT` generation, fixing MIME type error on hydration.

View file

@ -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) {