File tree Expand file tree Collapse file tree 3 files changed +20
-13
lines changed
Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Original file line number Diff line number Diff line change 11; ( async ( ) => {
22 const child = require ( 'child_process' )
3- const fs = require ( 'fs' )
43 const { build} = require ( 'esbuild' )
54
65 await build ( {
7- outdir : 'dist' ,
6+ outfile : 'dist/index.mjs ' ,
87 format : 'esm' ,
98 target : 'es6' ,
109 bundle : true ,
1110 external : [ '@testing-library/dom' ] ,
1211 entryPoints : [ 'src/index.ts' ] ,
1312 } )
1413
15- fs . writeFileSync (
16- 'dist/package.json' ,
17- JSON . stringify ( {
18- type : 'module' ,
19- } ) ,
20- )
14+ await build ( {
15+ outfile : 'dist/index.cjs' ,
16+ format : 'cjs' ,
17+ target : 'node12' ,
18+ bundle : true ,
19+ external : [ '@testing-library/dom' ] ,
20+ entryPoints : [ 'src/index.ts' ] ,
21+ } )
2122
2223 child . execSync ( 'yarn tsc -p tsconfig.build.json' )
2324} ) ( )
Original file line number Diff line number Diff line change 2525 "files" : [
2626 " dist"
2727 ],
28- "main" : " ./dist/index.js" ,
29- "exports" : " ./dist/index.js" ,
28+ "main" : " ./dist/index.cjs" ,
29+ "module" : " ./dist/index.mjs" ,
30+ "exports" : {
31+ "." : {
32+ "require" : " ./dist/index.cjs" ,
33+ "default" : " ./dist/index.mjs"
34+ }
35+ },
36+ "types" : " ./dist/types/index.d.ts" ,
3037 "scripts" : {
3138 "build" : " node build.js" ,
3239 "lint" : " kcd-scripts lint" ,
Original file line number Diff line number Diff line change 22 "extends" : " ./tsconfig.json" ,
33 "include" : [" ./src" ],
44 "compilerOptions" : {
5- "outFile " : " dist/index.d.ts " ,
5+ "outDir " : " dist/types " ,
66 "noEmit" : false ,
77 "declaration" : true ,
8- "emitDeclarationOnly" : true ,
9- "isolatedModules" : false
8+ "emitDeclarationOnly" : true
109 }
1110}
You can’t perform that action at this time.
0 commit comments