Skip to content

Commit 3aa155b

Browse files
committed
Exclude exports fields if we delete the files entry
1 parent 54cbe8c commit 3aa155b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

scripts/rollup/packaging.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ function filterOutEntrypoints(name) {
180180
i--;
181181
unlinkSync(`build/node_modules/${name}/${filename}`);
182182
changed = true;
183+
// Remove it from the exports field too if it exists.
184+
const exportsJSON = packageJSON.exports;
185+
if (exportsJSON) {
186+
if (filename === 'index.js') {
187+
delete exportsJSON['.'];
188+
} else {
189+
delete exportsJSON['./' + filename.replace(/\.js$/, '')];
190+
}
191+
}
183192
}
184193
}
185194
if (changed) {

0 commit comments

Comments
 (0)