Simplify internal resolver in dev (#6576)

This commit is contained in:
Bjorn Lu 2023-03-18 17:58:21 +08:00 committed by GitHub
parent fa132e35c2
commit 3881901028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Simplify internal resolver in dev

View file

@ -8,13 +8,6 @@ export function createResolve(loader: ModuleLoader, root: URL) {
// - /Users/macos/project/src/Foo.vue
// - C:/Windows/project/src/Foo.vue (normalized slash)
return async function (s: string) {
const url = await resolveIdToUrl(loader, s, root);
// Vite does not resolve .jsx -> .tsx when coming from hydration script import,
// clip it so Vite is able to resolve implicitly.
if (url.startsWith('/') && url.endsWith('.jsx')) {
return url.slice(0, -4);
} else {
return url;
}
return await resolveIdToUrl(loader, s, root);
};
}