From 4b968bace44f95551a734e8b85d05e1cb31b9f68 Mon Sep 17 00:00:00 2001 From: Evan Jacobs <570070+probablyup@users.noreply.github.com> Date: Mon, 14 Nov 2022 13:00:01 -0500 Subject: [PATCH] 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. --- src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.js b/src/index.js index 99e6a8fc..f65710f2 100644 --- a/src/index.js +++ b/src/index.js @@ -481,6 +481,7 @@ function createConfig(options, entry, format, writeMeta) { }, treeshake: { + annotations: options.compress, propertyReadSideEffects: false, },