@@ -80,20 +80,31 @@ yargs
80
80
} ,
81
81
] ) ;
82
82
83
- const target = targets [ 0 ] ;
84
- const entries = {
85
- main : path . join ( output , target , 'index.js' ) ,
86
- module : path . join ( output , 'module' , 'index.js' ) ,
87
- types : path . join ( output , 'typescript' , source , 'index.d.ts' ) ,
83
+ const target =
84
+ targets [ 0 ] === 'commonjs' || targets [ 0 ] === 'module'
85
+ ? targets [ 0 ]
86
+ : undefined ;
87
+
88
+ const entries : { [ key : string ] : string } = {
89
+ main : target
90
+ ? path . join ( output , target , 'index.js' )
91
+ : path . join ( source , 'index.js' ) ,
88
92
'react-native' : path . join ( source , 'index.js' ) ,
89
93
} ;
90
94
95
+ if ( targets . includes ( 'module' ) ) {
96
+ entries . module = path . join ( output , 'module' , 'index.js' ) ;
97
+ }
98
+
99
+ if ( targets . includes ( 'typescript' ) ) {
100
+ entries . types = path . join ( output , 'typescript' , source , 'index.d.ts' ) ;
101
+ }
102
+
91
103
const prepare = 'bob build' ;
92
104
const files = [ source , output ] ;
93
105
94
106
for ( const key in entries ) {
95
- // @ts -ignore
96
- const entry = entries [ key ] as string ;
107
+ const entry = entries [ key ] ;
97
108
98
109
if ( pkg [ key ] && pkg [ key ] !== entry ) {
99
110
const { replace } = await inquirer . prompt ( {
0 commit comments