Fix dev resolution of client modules on Windows (#2768)

* Fix dev resolution of client modules on Windows

* Adds a changeset
This commit is contained in:
Matthew Phillips 2022-03-11 17:28:48 -05:00 committed by GitHub
parent d4dbfe8974
commit 49c0d9970f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes loading astro/client/\* on Windows in dev

View file

@ -8,6 +8,7 @@ import { RouteCache } from '../route-cache.js';
import { resolveRenderers } from './renderers.js'; import { resolveRenderers } from './renderers.js';
import { errorHandler } from './error.js'; import { errorHandler } from './error.js';
import { getHmrScript } from './hmr.js'; import { getHmrScript } from './hmr.js';
import { prependForwardSlash } from '../../path.js';
import { render as coreRender } from '../core.js'; import { render as coreRender } from '../core.js';
import { createModuleScriptElementWithSrcSet } from '../ssr-element.js'; import { createModuleScriptElementWithSrcSet } from '../ssr-element.js';
@ -103,7 +104,7 @@ export async function render(renderers: Renderer[], mod: ComponentInstance, ssrO
// broken in the legacy build. This can be removed once the legacy build is removed. // broken in the legacy build. This can be removed once the legacy build is removed.
if (!astroConfig.buildOptions.legacyBuild) { if (!astroConfig.buildOptions.legacyBuild) {
const [, resolvedPath] = await viteServer.moduleGraph.resolveUrl(s); const [, resolvedPath] = await viteServer.moduleGraph.resolveUrl(s);
return resolvedPath; return '/@fs' + prependForwardSlash(resolvedPath);
} else { } else {
return s; return s;
} }