Fix pipeline beforeHydrationScript
handling (#8388)
This commit is contained in:
parent
8d12659ce8
commit
362491b8da
2 changed files with 6 additions and 1 deletions
5
.changeset/hot-colts-call.md
Normal file
5
.changeset/hot-colts-call.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Properly handle `BEFORE_HYDRATION_SCRIPT` generation, fixing MIME type error on hydration.
|
|
@ -36,7 +36,7 @@ export class BuildPipeline extends Pipeline {
|
||||||
compressHTML: manifest.compressHTML,
|
compressHTML: manifest.compressHTML,
|
||||||
async resolve(specifier: string) {
|
async resolve(specifier: string) {
|
||||||
const hashedFilePath = manifest.entryModules[specifier];
|
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,
|
// If no "astro:scripts/before-hydration.js" script exists in the build,
|
||||||
// then we can assume that no before-hydration scripts are needed.
|
// then we can assume that no before-hydration scripts are needed.
|
||||||
if (specifier === BEFORE_HYDRATION_SCRIPT_ID) {
|
if (specifier === BEFORE_HYDRATION_SCRIPT_ID) {
|
||||||
|
|
Loading…
Reference in a new issue