Skip to content

Commit

Permalink
Patch upstream nanobundle issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BasixKOR committed Oct 13, 2022
1 parent e67e290 commit 3472830
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .yarn/patches/nanobundle-npm-0.0.28-6c1dd68c44.patch
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);
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
"nanobundle": "^0.0.28",
"prettier": "^2.7.1",
"typescript": "^4.8.3"
},
"resolutions": {
"nanobundle@^0.0.28": "patch:nanobundle@npm%3A0.0.28#./.yarn/patches/nanobundle-npm-0.0.28-6c1dd68c44.patch"
}
}
22 changes: 21 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3393,7 +3393,7 @@ __metadata:
languageName: node
linkType: hard

"nanobundle@npm:^0.0.28":
"nanobundle@npm:0.0.28":
version: 0.0.28
resolution: "nanobundle@npm:0.0.28"
dependencies:
Expand All @@ -3413,6 +3413,26 @@ __metadata:
languageName: node
linkType: hard

"nanobundle@patch:nanobundle@npm%3A0.0.28#./.yarn/patches/nanobundle-npm-0.0.28-6c1dd68c44.patch::locator=root-workspace-0b6124%40workspace%3A.":
version: 0.0.28
resolution: "nanobundle@patch:nanobundle@npm%3A0.0.28#./.yarn/patches/nanobundle-npm-0.0.28-6c1dd68c44.patch::version=0.0.28&hash=c17101&locator=root-workspace-0b6124%40workspace%3A."
dependencies:
browserslist: ^4.19.3
esbuild: ^0.14.23
meow: ^10.1.2
pretty-bytes: ^6.0.0
tsconfck: ^1.2.0
peerDependencies:
typescript: ^3.7.0 || ^4.0.0
peerDependenciesMeta:
typescript:
optional: true
bin:
nanobundle: bin.mjs
checksum: 9d7098478bbe98d30d25a6b2013713c388f107ca2e9c68c0da0a87c53f30347fe6b4e3452b59a41697a297cdb2a877c5c88557b4a153eb02385c41994b31fafa
languageName: node
linkType: hard

"nanoid@npm:^3.3.4":
version: 3.3.4
resolution: "nanoid@npm:3.3.4"
Expand Down

0 comments on commit 3472830

Please sign in to comment.