Skip to content

Commit

Permalink
fix(build): refactor export targets for browser, node cjs, and node e…
Browse files Browse the repository at this point in the history
…sm builds
  • Loading branch information
panva committed Feb 3, 2024
1 parent 81222d2 commit 50cbc65
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions tools/publish-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ pkg.scripts = undefined
pkg.imports = undefined
pkg.description = undefined
pkg.main = undefined
pkg.exports['.'].import = undefined
pkg.exports['.'].require = undefined
pkg.keywords = undefined
pkg.exports['.'].node = pkg.exports['.'].browser
for (const exportPath of Object.keys(pkg.exports)) {
pkg.exports[exportPath].import = undefined
pkg.exports[exportPath].require = undefined
pkg.exports[exportPath].node = pkg.exports[exportPath].browser
}

pkg.files.push('!dist/**/package.json')
pkg.files.push('!dist/node/**/*')
Expand Down
8 changes: 5 additions & 3 deletions tools/publish-node-cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ pkg.imports = undefined
pkg.description = undefined
pkg.browser = undefined
pkg.deno = undefined
pkg.exports['.'].browser = undefined
pkg.exports['.'].deno = undefined
pkg.exports['.'].import = undefined
for (const exportPath of Object.keys(pkg.exports)) {
for (const runtime of ['browser', 'deno', 'import', 'bun', 'worker']) {
pkg.exports[exportPath][runtime] = undefined
}
}
pkg.keywords = undefined

pkg.files.push('!dist/browser/**/*')
Expand Down
8 changes: 5 additions & 3 deletions tools/publish-node-esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ pkg.imports = undefined
pkg.description = undefined
pkg.browser = undefined
pkg.deno = undefined
pkg.exports['.'].browser = undefined
pkg.exports['.'].deno = undefined
pkg.exports['.'].require = undefined
for (const exportPath of Object.keys(pkg.exports)) {
for (const runtime of ['browser', 'deno', 'require', 'bun', 'worker']) {
pkg.exports[exportPath][runtime] = undefined
}
}
pkg.keywords = undefined

pkg.files.push('!dist/**/package.json')
Expand Down

0 comments on commit 50cbc65

Please sign in to comment.