summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2022-03-15 11:26:46 -0400
committerGravatar GitHub <noreply@github.com> 2022-03-15 11:26:46 -0400
commit58d8686e94816da649b0210f5288173fb4b9a483 (patch)
treef786005a5e659d0a01b4136297e6f1925738d904
parent1325fe90fc3b6a263f30920d4c1401b29402408f (diff)
downloadastro-58d8686e94816da649b0210f5288173fb4b9a483.tar.gz
astro-58d8686e94816da649b0210f5288173fb4b9a483.tar.zst
astro-58d8686e94816da649b0210f5288173fb4b9a483.zip
Fix for allowing space in folder name (#2797)
* Fix for allowing space in folder name * Adds a changeset * Prepend a forward slash, for windows
Diffstat (limited to '')
-rw-r--r--.changeset/grumpy-dancers-smell.md5
-rw-r--r--packages/astro/src/vite-plugin-astro/compile.ts4
2 files changed, 8 insertions, 1 deletions
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<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>) => {