Simplify internal resolver in dev (#6576)
This commit is contained in:
parent
fa132e35c2
commit
3881901028
2 changed files with 6 additions and 8 deletions
5
.changeset/soft-plants-hope.md
Normal file
5
.changeset/soft-plants-hope.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Simplify internal resolver in dev
|
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue