Remove use of URL module in runtime (#2107)
* Remove use of URL module We can't use this module due to Vite not having a shim and this needing to run inside Vite. * Adding a changeset
This commit is contained in:
parent
b098f04dc3
commit
4c44467668
2 changed files with 8 additions and 2 deletions
7
.changeset/empty-oranges-provide.md
Normal file
7
.changeset/empty-oranges-provide.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes regression in build caused by use of URL module
|
||||||
|
|
||||||
|
Using this module breaks the build because Vite tries to shim it, incorrectly.
|
|
@ -2,7 +2,6 @@ import type { AstroComponentMetadata, Renderer } from '../../@types/astro';
|
||||||
import type { AstroGlobalPartial, SSRResult, SSRElement } from '../../@types/astro';
|
import type { AstroGlobalPartial, SSRResult, SSRElement } from '../../@types/astro';
|
||||||
|
|
||||||
import shorthash from 'shorthash';
|
import shorthash from 'shorthash';
|
||||||
import { pathToFileURL } from 'url';
|
|
||||||
import { extractDirectives, generateHydrateScript } from './hydration.js';
|
import { extractDirectives, generateHydrateScript } from './hydration.js';
|
||||||
import { serializeListValue } from './util.js';
|
import { serializeListValue } from './util.js';
|
||||||
export { createMetadata } from './metadata.js';
|
export { createMetadata } from './metadata.js';
|
||||||
|
@ -289,7 +288,7 @@ function createFetchContentFn(url: URL) {
|
||||||
// Inside of getStaticPaths.
|
// Inside of getStaticPaths.
|
||||||
export function createAstro(fileURLStr: string, site: string, projectRootStr: string): AstroGlobalPartial {
|
export function createAstro(fileURLStr: string, site: string, projectRootStr: string): AstroGlobalPartial {
|
||||||
const url = new URL(fileURLStr);
|
const url = new URL(fileURLStr);
|
||||||
const projectRoot = projectRootStr === '.' ? pathToFileURL(process.cwd()) : new URL(projectRootStr);
|
const projectRoot = new URL(projectRootStr);
|
||||||
const fetchContent = createFetchContentFn(url);
|
const fetchContent = createFetchContentFn(url);
|
||||||
return {
|
return {
|
||||||
site: new URL(site),
|
site: new URL(site),
|
||||||
|
|
Loading…
Reference in a new issue