-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
diff --git a/bin.mjs b/bin.mjs | ||
index 57bd96f6f8dff4f700b12a5a40572ea38f09b46d..929c72a9b9ae459cb0829ad6aac4567703641427 100644 | ||
--- a/bin.mjs | ||
+++ b/bin.mjs | ||
@@ -279,8 +279,12 @@ Or you may not need to specify "require" or "node" entries. | ||
} | ||
function addNodeEntry(key, output) { | ||
const ext = path.extname(output); | ||
- if (ext === ".js" || ext === ".cjs" || ext === ".node") { | ||
- addEntry(key, output, "node", "commonjs"); | ||
+ if (ext === ".js") { | ||
+ addEntry(key, output, "node", defaultModule); | ||
+ } else if (ext === ".cjs" || ext === ".node") { | ||
+ addEntry(key, output, "node", "commonjs") | ||
+ } else if (ext === ".mjs") { | ||
+ addEntry(key, output, "node", "esmodule"); | ||
} | ||
} | ||
if (config.main) { | ||
@@ -299,6 +303,8 @@ Or you may not need to specify "require" or "node" entries. | ||
addModuleEntry(`exports["${key}"]`, output); | ||
} else if (key === "require") { | ||
addNodeEntry(`exports["${key}"]`, output); | ||
+ } else if (key === "node") { | ||
+ addNodeEntry(`exports["${key}"]`, output); | ||
} else { | ||
addMainEntry(`exports["${key}"]`, output); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters