Skip to content

Commit

Permalink
Fix: preserve terser annotations regexp (#875)
Browse files Browse the repository at this point in the history
* fix: preserve terser annotations regexp

* chore: add changeset

* test: update snapshots
  • Loading branch information
dwightjack authored Oct 6, 2021
1 parent 1b61029 commit 5d0465b
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 88 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-cherries-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'microbundle': patch
---

Preserve terser annotations in compressed bundle
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ function createConfig(options, entry, format, writeMeta) {
// By default, Terser wraps function arguments in extra parens to trigger eager parsing.
// Whether this is a good idea is way too specific to guess, so we optimize for size by default:
wrap_func_args: false,
comments: /^\s*([@#]__[A-Z]__\s*$|@cc_on)/,
comments: /^\s*([@#]__[A-Z]+__\s*$|@cc_on)/,
preserve_annotations: true,
},
module: modern,
Expand Down
Loading

0 comments on commit 5d0465b

Please sign in to comment.