File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
packages/react-native-builder-bob/src/utils Expand file tree Collapse file tree 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({
6868 }
6969
7070 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
7374 // 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+ }
7681
7782 await Promise . all (
7883 files . map ( async ( filepath ) => {
You can’t perform that action at this time.
0 commit comments