-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
exports.node
should be considered node
platform
#46
Comments
BasixKOR
changed the title
Oct 13, 2022
export.node
should be considered node
platformexports.node
should be considered node
platform
Proposed patch: 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);
} |
BasixKOR
added a commit
to planetarium/sphere
that referenced
this issue
Oct 13, 2022
This will be handled in #44 |
Hey @BasixKOR , |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Minimal reproduction: https://stackblitz.com/edit/node-h1e2ll (broken in browser; please download)
It seems like the platform of the entry doesn't take
node
condition into account.The text was updated successfully, but these errors were encountered: