File tree 3 files changed +20
-13
lines changed
3 files changed +20
-13
lines changed Original file line number Diff line number Diff line change 1
1
; ( async ( ) => {
2
2
const child = require ( 'child_process' )
3
- const fs = require ( 'fs' )
4
3
const { build} = require ( 'esbuild' )
5
4
6
5
await build ( {
7
- outdir : 'dist' ,
6
+ outfile : 'dist/index.mjs ' ,
8
7
format : 'esm' ,
9
8
target : 'es6' ,
10
9
bundle : true ,
11
10
external : [ '@testing-library/dom' ] ,
12
11
entryPoints : [ 'src/index.ts' ] ,
13
12
} )
14
13
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
+ } )
21
22
22
23
child . execSync ( 'yarn tsc -p tsconfig.build.json' )
23
24
} ) ( )
Original file line number Diff line number Diff line change 25
25
"files" : [
26
26
" dist"
27
27
],
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" ,
30
37
"scripts" : {
31
38
"build" : " node build.js" ,
32
39
"lint" : " kcd-scripts lint" ,
Original file line number Diff line number Diff line change 2
2
"extends" : " ./tsconfig.json" ,
3
3
"include" : [" ./src" ],
4
4
"compilerOptions" : {
5
- "outFile " : " dist/index.d.ts " ,
5
+ "outDir " : " dist/types " ,
6
6
"noEmit" : false ,
7
7
"declaration" : true ,
8
- "emitDeclarationOnly" : true ,
9
- "isolatedModules" : false
8
+ "emitDeclarationOnly" : true
10
9
}
11
10
}
You can’t perform that action at this time.
0 commit comments