Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollback "Remove workaround 'force the dependency version of react equals to react-dom'" #1032

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions server/build_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,11 @@ func (ctx *BuildContext) resolveExternalModule(specifier string, kind api.Resolv
}
}

// [workaround] force the dependency version of `react` equals to react-dom
if ctx.esm.PkgName == "react-dom" && dep.PkgName == "react" {
dep.PkgVersion = ctx.esm.PkgVersion
}

if withTypeJSON {
resolvedPath = "/" + dep.Specifier()
if subPath == "" || !strings.HasSuffix(subPath, ".json") {
Expand Down
7 changes: 7 additions & 0 deletions test/fix-url/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,10 @@ Deno.test("redirect to css entry", async () => {
assertEquals(res.status, 301);
assertEquals(res.headers.get("location"), "http://localhost:8080/@markprompt/[email protected]/markprompt.css");
});

Deno.test("[workaround] force the dependency version of react equals to react-dom", async () => {
const res = await fetch("http://localhost:8080/[email protected]?target=es2022");
assertEquals(res.status, 200);
const js = await res.text();
assertStringIncludes(js, '"/[email protected]/es2022/react.mjs"');
});
Loading