Skip to content

Commit

Permalink
Exclude exports fields if we delete the files entry
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Feb 9, 2022
1 parent 54cbe8c commit 3aa155b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/rollup/packaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ function filterOutEntrypoints(name) {
i--;
unlinkSync(`build/node_modules/${name}/${filename}`);
changed = true;
// Remove it from the exports field too if it exists.
const exportsJSON = packageJSON.exports;
if (exportsJSON) {
if (filename === 'index.js') {
delete exportsJSON['.'];
} else {
delete exportsJSON['./' + filename.replace(/\.js$/, '')];
}
}
}
}
if (changed) {
Expand Down

0 comments on commit 3aa155b

Please sign in to comment.