Skip to content

Commit

Permalink
Simplify internal resolver in dev (#6576)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Mar 18, 2023
1 parent fa132e3 commit 3881901
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-plants-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Simplify internal resolver in dev
9 changes: 1 addition & 8 deletions packages/astro/src/core/render/dev/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}

0 comments on commit 3881901

Please sign in to comment.