Skip to content

Commit

Permalink
fix: do not infer .json subpath exports to build
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 13, 2022
1 parent dd456a0 commit b57afec
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/utils.ts
Expand Up @@ -133,9 +133,12 @@ export function extractExportFilenames (exports: PackageJson['exports'], conditi
if (typeof exports === 'string') {
return [{ file: exports, type: 'esm' }]
}
return Object.entries(exports).flatMap(
([condition, exports]) => typeof exports === 'string'
? { file: exports, type: inferExportType(condition, conditions, exports) }
: extractExportFilenames(exports, [...conditions, condition])
)
return Object.entries(exports)
// Filter out .json subpaths such as package.json
.filter(([subpath]) => !subpath.endsWith('.json'))
.flatMap(
([condition, exports]) => typeof exports === 'string'
? { file: exports, type: inferExportType(condition, conditions, exports) }
: extractExportFilenames(exports, [...conditions, condition])
)
}

0 comments on commit b57afec

Please sign in to comment.