File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { build } from "esbuild" ;
22import { copyFileSync } from "fs" ;
3+ import { dirname , resolve } from "path" ;
4+ import { fileURLToPath } from "url" ;
5+
6+ const rootDir = dirname ( fileURLToPath ( import . meta. url ) ) ;
37
48const entries = [
59 { entry : "src/index.js" , base : "index" , globalName : "__tc" } ,
@@ -11,6 +15,7 @@ const entries = [
1115await Promise . all (
1216 entries . flatMap ( ( { entry, base, globalName } ) => [
1317 build ( {
18+ absWorkingDir : rootDir ,
1419 entryPoints : [ entry ] ,
1520 bundle : true ,
1621 format : "esm" ,
@@ -19,6 +24,7 @@ await Promise.all(
1924 target : [ "es2020" ] ,
2025 } ) ,
2126 build ( {
27+ absWorkingDir : rootDir ,
2228 entryPoints : [ entry ] ,
2329 bundle : true ,
2430 format : "iife" ,
@@ -36,6 +42,9 @@ await Promise.all(
3642 ] ) ,
3743) ;
3844
39- copyFileSync ( "src/index.d.ts" , "index.d.ts" ) ;
45+ copyFileSync (
46+ resolve ( rootDir , "src/index.d.ts" ) ,
47+ resolve ( rootDir , "index.d.ts" ) ,
48+ ) ;
4049
4150console . log ( "Build complete" ) ;
You can’t perform that action at this time.
0 commit comments