From 3a43569317c61d76c63465b754b04a239743bed9 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Tue, 30 Aug 2022 12:37:34 +0100 Subject: [PATCH 1/2] fix: remove single-import from exports map Because we merge an object with the `"."` style export, remove any single-export style fields. --- src/check-project/utils.js | 7 +++++++ src/cmds/check-project.js | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/check-project/utils.js b/src/check-project/utils.js index 2963c6fc3..a34e4c7d3 100644 --- a/src/check-project/utils.js +++ b/src/check-project/utils.js @@ -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) { diff --git a/src/cmds/check-project.js b/src/cmds/check-project.js index 175dd9f1b..d11bc9271 100644 --- a/src/cmds/check-project.js +++ b/src/cmds/check-project.js @@ -26,5 +26,9 @@ export default { */ async handler (argv) { await checkProjectCmd.run(argv) + .catch(err => { + console.error(err) + process.exit(1) + }) } } From 446e04553ea78a3203b177684adbc7e990319948 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Tue, 30 Aug 2022 12:49:48 +0100 Subject: [PATCH 2/2] chore: linting --- src/cmds/check-project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmds/check-project.js b/src/cmds/check-project.js index d11bc9271..9e3478453 100644 --- a/src/cmds/check-project.js +++ b/src/cmds/check-project.js @@ -27,7 +27,7 @@ export default { async handler (argv) { await checkProjectCmd.run(argv) .catch(err => { - console.error(err) + console.error(err) // eslint-disable-line no-console process.exit(1) }) }