@@ -80,20 +80,31 @@ yargs
8080      } , 
8181    ] ) ; 
8282
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' ) , 
8892      'react-native' : path . join ( source ,  'index.js' ) , 
8993    } ; 
9094
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+ 
91103    const  prepare  =  'bob build' ; 
92104    const  files  =  [ source ,  output ] ; 
93105
94106    for  ( const  key  in  entries )  { 
95-       // @ts -ignore 
96-       const  entry  =  entries [ key ]  as  string ; 
107+       const  entry  =  entries [ key ] ; 
97108
98109      if  ( pkg [ key ]  &&  pkg [ key ]  !==  entry )  { 
99110        const  {  replace }  =  await  inquirer . prompt ( { 
0 commit comments