File tree 1 file changed +9
-4
lines changed
packages/react-native-builder-bob/src/utils
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -68,11 +68,16 @@ export default async function compile({
68
68
}
69
69
70
70
await fs . mkdirp ( output ) ;
71
- await fs . writeJSON ( path . join ( output , 'package.json' ) , {
72
- // Treat code with ESM syntax as CommonJS if `esm` is not enabled
71
+
72
+ if ( ! esm ) {
73
+ // Ideally we should code with ESM syntax as CommonJS if `esm` is not enabled
73
74
// This maintain compatibility with code written for CommonJS
74
- type : modules === 'commonjs' || ! esm ? 'commonjs' : 'module' ,
75
- } ) ;
75
+ // However currently NextJS has non-standard behavior and breaks this
76
+ // So for now we only set this conditionally
77
+ await fs . writeJSON ( path . join ( output , 'package.json' ) , {
78
+ type : modules === 'commonjs' ? 'commonjs' : 'module' ,
79
+ } ) ;
80
+ }
76
81
77
82
await Promise . all (
78
83
files . map ( async ( filepath ) => {
You can’t perform that action at this time.
0 commit comments