diff --git a/.changeset/grumpy-dancers-smell.md b/.changeset/grumpy-dancers-smell.md new file mode 100644 index 000000000..691e935a3 --- /dev/null +++ b/.changeset/grumpy-dancers-smell.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix for projects with a folder name containing a space diff --git a/packages/astro/src/vite-plugin-astro/compile.ts b/packages/astro/src/vite-plugin-astro/compile.ts index 4385d9468..f9075e3e7 100644 --- a/packages/astro/src/vite-plugin-astro/compile.ts +++ b/packages/astro/src/vite-plugin-astro/compile.ts @@ -7,6 +7,8 @@ import fs from 'fs'; import { fileURLToPath } from 'url'; import { transform } from '@astrojs/compiler'; import { transformWithVite } from './styles.js'; +import { viteID } from '../core/util.js'; +import { prependForwardSlash } from '../core/path.js'; type CompilationCache = Map; type CompileResult = TransformResult & { rawCSSDeps: Set }; @@ -49,7 +51,7 @@ async function compile(config: AstroConfig, filename: string, source: string, vi site: config.buildOptions.site, sourcefile: filename, sourcemap: 'both', - internalURL: `/@fs${new URL('../runtime/server/index.js', import.meta.url).pathname}`, + internalURL: `/@fs${prependForwardSlash(viteID(new URL('../runtime/server/index.js', import.meta.url)))}`, experimentalStaticExtraction: !config.buildOptions.legacyBuild, // TODO add experimental flag here preprocessStyle: async (value: string, attrs: Record) => {