@@ -308,15 +308,12 @@ async function applySocketOverrideIfExists(packageName, packagePath) {
308308 return
309309 }
310310
311- // Merge exports: Socket exports take precedence.
312- const mergedExports = overridePkgJson . exports
313- ? { ...existingPkgJson . content . exports , ...overridePkgJson . exports }
314- : existingPkgJson . content . exports
315-
316311 // Update package.json with Socket override fields.
317312 // Note: We intentionally do NOT overwrite scripts here to preserve test scripts.
313+ // Note: We use Socket exports entirely to avoid mixing incompatible formats
314+ // (conditional exports vs subpath exports).
318315 existingPkgJson . update ( {
319- exports : mergedExports ,
316+ ... ( overridePkgJson . exports ? { exports : overridePkgJson . exports } : { } ) ,
320317 main : overridePkgJson . main ,
321318 module : overridePkgJson . module ,
322319 } )
@@ -429,15 +426,11 @@ async function installPackage(packageInfo) {
429426 const overridePkgJson = await readPackageJson ( overridePkgJsonPath )
430427
431428 // Selectively update the fields from Socket override.
432- // Merge exports: use Socket's exports but preserve any original subpaths.
429+ // Note: Use Socket exports entirely to avoid mixing incompatible formats
430+ // (conditional exports vs subpath exports).
433431 existingPkgJson . update ( {
434432 ...( overridePkgJson . exports
435- ? {
436- exports : {
437- ...existingPkgJson . exports ,
438- ...overridePkgJson . exports ,
439- } ,
440- }
433+ ? { exports : overridePkgJson . exports }
441434 : { } ) ,
442435 main : overridePkgJson . main ,
443436 module : overridePkgJson . module ,
@@ -623,16 +616,12 @@ async function installPackage(packageInfo) {
623616 // Selectively merge Socket override fields into original package.json.
624617 // We want: exports, main, module, types, files, sideEffects, socket
625618
626- // Merge exports: use Socket's exports but preserve any original subpaths
627- // that don't conflict (like special aliases or paths we don't override).
628- const mergedExports = overridePkgJson . exports
629- ? { ...originalPkgJson . content . exports , ...overridePkgJson . exports }
630- : originalPkgJson . content . exports
631-
632619 // Update the package.json with merged fields.
620+ // Note: Use Socket exports entirely to avoid mixing incompatible formats
621+ // (conditional exports vs subpath exports).
633622 originalPkgJson . update ( {
634623 // Override these specific fields from Socket package.
635- exports : mergedExports ,
624+ ... ( overridePkgJson . exports ? { exports : overridePkgJson . exports } : { } ) ,
636625 main : overridePkgJson . main ,
637626 module : overridePkgJson . module ,
638627 types : overridePkgJson . types ,
0 commit comments