Skip to content

Commit

Permalink
fix: ignore single-import from exports map (#1063)
Browse files Browse the repository at this point in the history
Because we merge an object with the `"."` style export, ignore any single-export style fields.
  • Loading branch information
achingbrain authored Aug 30, 2022
1 parent c04a0f7 commit 77e43ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/check-project/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ export function sortExportsMap (obj) {

for (const key of Object.keys(sorted)) {
const entry = sorted[key]

// ignore case where obj has string props, e.g. `"exports": { "import": "./src/index.js" }`
// as we have already merged `"exports": { ".": { "import": "./src/index.js" } }`
if (typeof entry === 'string') {
continue
}

let types = entry.types

if (!types) {
Expand Down
4 changes: 4 additions & 0 deletions src/cmds/check-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ export default {
*/
async handler (argv) {
await checkProjectCmd.run(argv)
.catch(err => {
console.error(err) // eslint-disable-line no-console
process.exit(1)
})
}
}

0 comments on commit 77e43ce

Please sign in to comment.