Skip to content

Commit

Permalink
Fix node builtin modules imports (close #566)
Browse files Browse the repository at this point in the history
  • Loading branch information
ije committed Mar 25, 2023
1 parent 2f8e28c commit 8f261b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,10 @@ esbuild:
if cjsContext {
p = bytes.TrimPrefix(p, []byte{')'})
var marked bool
if _, ok := builtInNodeModules[name]; !ok {
if builtInNodeModules[name] {
cjsImportNames.Add("default")
marked = true
} else {
depPkg, _, err := validatePkgPath(name)
depWd := task.wd
if err == nil && !fileExists(path.Join(depWd, "node_modules", depPkg.Name, "package.json")) {
Expand Down
7 changes: 7 additions & 0 deletions test/issue-566/issue-566.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";

import { Expo } from "http://localhost:8080/[email protected]";

Deno.test("issue #566", () => {
assertEquals(typeof Expo, "function");
});

0 comments on commit 8f261b7

Please sign in to comment.