fix(api): correctly merge pkg exports in `after-build.js` script
@@ -13,8 +13,11 @@ const modules = readdirSync('src').map((mod) => mod.replace('.ts', ''))
if (!pkg.exports) {
pkg.exports = {}
}
-const outputPkg = Object.assign(
- pkg.exports,
+
+const outputPkg = {
+ ...pkg,
+ exports: Object.assign(
+ {},
...modules.map((mod) => {
let temp = {}
let key = `./${mod}`
@@ -32,6 +35,7 @@ const outputPkg = Object.assign(
// this will ensure it doesn't get overwritten by the logic above
{ ...pkg.exports }
)
+}
writeFileSync('dist/package.json', JSON.stringify(outputPkg, undefined, 2))
/**
