Skip to content

Commit

Permalink
Fix for allowing space in folder name (#2797)
Browse files Browse the repository at this point in the history
* Fix for allowing space in folder name

* Adds a changeset

* Prepend a forward slash, for windows
  • Loading branch information
matthewp authored Mar 15, 2022
1 parent 1325fe9 commit 58d8686
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-dancers-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix for projects with a folder name containing a space
4 changes: 3 additions & 1 deletion packages/astro/src/vite-plugin-astro/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> };
Expand Down Expand Up @@ -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>) => {
Expand Down

0 comments on commit 58d8686

Please sign in to comment.