diff --git a/examples/subpath/astro.config.mjs b/examples/subpath/astro.config.mjs index 989f60121..7a7a3ed2d 100644 --- a/examples/subpath/astro.config.mjs +++ b/examples/subpath/astro.config.mjs @@ -10,7 +10,7 @@ export default /** @type {import('astro').AstroUserConfig} */ ({ // Comment out "renderers: []" to enable Astro's default component support. buildOptions: { - site: 'http://example.com/blog' + site: 'http://example.com/blog', }, renderers: ['@astrojs/renderer-react'], }); diff --git a/examples/subpath/src/components/Time.jsx b/examples/subpath/src/components/Time.jsx index 8172b77dd..8b5837c85 100644 --- a/examples/subpath/src/components/Time.jsx +++ b/examples/subpath/src/components/Time.jsx @@ -1,7 +1,7 @@ import React from 'react'; -export default function() { +export default function () { const date = new Date(); const format = new Intl.DateTimeFormat('en-US'); - return {format.format(date)} -} \ No newline at end of file + return {format.format(date)}; +} diff --git a/examples/subpath/src/styles/main.scss b/examples/subpath/src/styles/main.scss index 573fc4396..a54a15f01 100644 --- a/examples/subpath/src/styles/main.scss +++ b/examples/subpath/src/styles/main.scss @@ -2,4 +2,4 @@ body { #app { color: tomato; } -} \ No newline at end of file +} diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index b3a514e88..d7adb4745 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -184,7 +184,7 @@ class AstroBuilder { publicDir: viteConfig.publicDir, root: viteConfig.root, server: viteConfig.server, - base: this.config.buildOptions.site ? new URL(this.config.buildOptions.site).pathname : '/' + base: this.config.buildOptions.site ? new URL(this.config.buildOptions.site).pathname : '/', }); debug(logging, 'build', timerMessage('Vite build finished', timer.buildStart)); diff --git a/packages/astro/src/core/dev/index.ts b/packages/astro/src/core/dev/index.ts index 5c81f4101..66e891dce 100644 --- a/packages/astro/src/core/dev/index.ts +++ b/packages/astro/src/core/dev/index.ts @@ -234,7 +234,7 @@ export class AstroDevServer { server: { middlewareMode: 'ssr', host: this.hostname, - } + }, }, this.config.vite || {} ), @@ -278,7 +278,7 @@ export class AstroDevServer { let filePath: URL | undefined; try { let routePathname = pathname.startsWith(this.pathname) ? pathname.substr(this.pathname.length) || '/' : undefined; - if(!routePathname) { + if (!routePathname) { next(); return; } @@ -363,7 +363,7 @@ export class AstroDevServer { } // if not found, fall back to default template else { - if(pathname === '/' && !pathname.startsWith(this.pathname)) { + if (pathname === '/' && !pathname.startsWith(this.pathname)) { html = subpathNotUsedTemplate(this.pathname, pathname); } else { html = notFoundTemplate({ statusCode, title: 'Not found', tabTitle: '404: Not Found', pathname }); diff --git a/packages/astro/src/core/dev/template/4xx.ts b/packages/astro/src/core/dev/template/4xx.ts index b24e87098..e321a881a 100644 --- a/packages/astro/src/core/dev/template/4xx.ts +++ b/packages/astro/src/core/dev/template/4xx.ts @@ -47,9 +47,12 @@ export default function template({ title, pathname, statusCode = 404, tabTitle, ${statusCode ? `${statusCode}: ` : ''}${title} - ${body || ` + ${ + body || + ` Path: ${encode(pathname)} - `} + ` + }
Path: ${encode(pathname)}