Skip to content

Commit 4751fd6

Browse files
authored
Rollback "Remove workaround 'force the dependency version of react equals to react-dom'" (#1032)
1 parent fc8c0b3 commit 4751fd6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

server/build_resolver.go

+5
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,11 @@ func (ctx *BuildContext) resolveExternalModule(specifier string, kind api.Resolv
753753
}
754754
}
755755

756+
// [workaround] force the dependency version of `react` equals to react-dom
757+
if ctx.esm.PkgName == "react-dom" && dep.PkgName == "react" {
758+
dep.PkgVersion = ctx.esm.PkgVersion
759+
}
760+
756761
if withTypeJSON {
757762
resolvedPath = "/" + dep.Specifier()
758763
if subPath == "" || !strings.HasSuffix(subPath, ".json") {

test/fix-url/test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,10 @@ Deno.test("redirect to css entry", async () => {
160160
assertEquals(res.status, 301);
161161
assertEquals(res.headers.get("location"), "http://localhost:8080/@markprompt/[email protected]/markprompt.css");
162162
});
163+
164+
Deno.test("[workaround] force the dependency version of react equals to react-dom", async () => {
165+
const res = await fetch("http://localhost:8080/[email protected]?target=es2022");
166+
assertEquals(res.status, 200);
167+
const js = await res.text();
168+
assertStringIncludes(js, '"/[email protected]/es2022/react.mjs"');
169+
});

0 commit comments

Comments
 (0)