@@ -8,6 +8,9 @@ const sharedOptions = {
88 minify : false ,
99 allowOverwrite : true ,
1010 packages : "external" ,
11+ platform : "neutral" ,
12+ format : "esm" ,
13+ target : "es2022" ,
1114} ;
1215
1316async function main ( ) {
@@ -18,8 +21,6 @@ async function main() {
1821 entryPoints : await glob ( [ "./src/*.ts" , "./src/**/*.ts" ] ) ,
1922 outdir : "pkg/dist-src" ,
2023 bundle : false ,
21- platform : "neutral" ,
22- format : "esm" ,
2324 ...sharedOptions ,
2425 sourcemap : false ,
2526 } ) ;
@@ -35,27 +36,12 @@ async function main() {
3536
3637 const entryPoints = [ "./pkg/dist-src/index.js" ] ;
3738
38- await Promise . all ( [
39- // Build the a CJS Node.js bundle
40- esbuild . build ( {
41- entryPoints,
42- outdir : "pkg/dist-node" ,
43- bundle : true ,
44- platform : "node" ,
45- target : "node18" ,
46- format : "cjs" ,
47- ...sharedOptions ,
48- } ) ,
49- // Build an ESM browser bundle
50- esbuild . build ( {
51- entryPoints,
52- outdir : "pkg/dist-web" ,
53- bundle : true ,
54- platform : "browser" ,
55- format : "esm" ,
56- ...sharedOptions ,
57- } ) ,
58- ] ) ;
39+ await esbuild . build ( {
40+ entryPoints,
41+ outdir : "pkg/dist-bundle" ,
42+ bundle : true ,
43+ ...sharedOptions ,
44+ } ) ;
5945
6046 // Copy the README, LICENSE to the pkg folder
6147 await copyFile ( "LICENSE" , "pkg/LICENSE" ) ;
@@ -74,12 +60,12 @@ async function main() {
7460 {
7561 ...pkg ,
7662 files : [ "dist-*/**" , "bin/**" ] ,
77- main : "dist-node /index.js" ,
63+ main : "dist-bundle /index.js" ,
7864 types : "dist-types/index.d.ts" ,
7965 exports : {
8066 "." : {
8167 types : "./dist-types/index.d.ts" ,
82- import : "./dist-node /index.js" ,
68+ import : "./dist-bundle /index.js" ,
8369 }
8470 } ,
8571 sideEffects : false ,
0 commit comments