Skip to content

Commit

Permalink
Fix mangle.json being overwritten with [object Object] (#926)
Browse files Browse the repository at this point in the history
* Fix mangle.json being overwritten with [object Object]

Regression from #882.

* Create gorgeous-singers-invite.md
  • Loading branch information
developit authored Jan 20, 2022
1 parent 778ca3c commit f04c85a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-singers-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"microbundle": patch
---

Fix mangle.json being overwritten with `[object Object]`
13 changes: 4 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,10 @@ function createConfig(options, entry, format, writeMeta) {
// after hook
writeBundle() {
if (writeMeta && nameCache) {
fs.writeFile(
getNameCachePath(),
JSON.stringify(
endsWithNewLine ? `${nameCache}${EOL}` : nameCache,
null,
2,
),
() => {},
);
let filename = getNameCachePath();
let json = JSON.stringify(nameCache, null, 2);
if (endsWithNewLine) json += EOL;
fs.writeFile(filename, json, () => {});
}
},
},
Expand Down

0 comments on commit f04c85a

Please sign in to comment.