Fix for allowing space in folder name (#2797)

* Fix for allowing space in folder name

* Adds a changeset

* Prepend a forward slash, for windows
This commit is contained in:
Matthew Phillips 2022-03-15 11:26:46 -04:00 committed by GitHub
parent 1325fe90fc
commit 58d8686e94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix for projects with a folder name containing a space

View file

@ -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<string, CompileResult>;
type CompileResult = TransformResult & { rawCSSDeps: Set<string> };
@ -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<string, string>) => {