diff --git a/server/build.go b/server/build.go index 6287a50fc..332b69500 100644 --- a/server/build.go +++ b/server/build.go @@ -773,7 +773,11 @@ rebuild: } // if the dep is an es6 module if !marked && depNpm.Module != "" { - cjsImportNames.Add("*?") + if depESM.HasExportDefault && len(depESM.NamedExports) == 1 { + cjsImportNames.Add("default") + } else { + cjsImportNames.Add("*?") + } marked = true } if !marked && includes(depESM.NamedExports, "__esModule") && depESM.HasExportDefault { diff --git a/test/issue-592/issue-592.test.ts b/test/issue-592/issue-592.test.ts new file mode 100644 index 000000000..dc1c5f2bc --- /dev/null +++ b/test/issue-592/issue-592.test.ts @@ -0,0 +1,7 @@ +import { assertEquals } from "https://deno.land/std@0.178.0/testing/asserts.ts"; + +import { createConnection } from "http://localhost:8080/mysql2@3.2.0"; + +Deno.test("issue #592", async () => { + assertEquals(typeof createConnection, "function"); +});