Skip to content

Commit 4b968ba

Browse files
authored
fix: disable tree-shaking via PURE annotations when compression is disabled
When building a library, "pure" comments are often added to various bits and pieces to ensure tree-shaking works properly in the destination bundle. Compression via terser will automatically drop these hints in some cases, so disabling compression serves the purpose of leaving total minification up to the destination bundler.
1 parent 22187fb commit 4b968ba

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ function createConfig(options, entry, format, writeMeta) {
481481
},
482482

483483
treeshake: {
484+
annotations: options.compress,
484485
propertyReadSideEffects: false,
485486
},
486487

0 commit comments

Comments
 (0)