Created
February 10, 2021 12:05
-
-
Save fluidsonic/db4f7b566cff547934043af1c3d6e87b to your computer and use it in GitHub Desktop.
Kotlin/JS TeserPlugin settings for optimization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// … | |
new TerserPlugin({ | |
terserOptions: { | |
// ecma: "2016", // doesn't work with some libraries | |
compress: { | |
keep_fargs: false, | |
negate_iife: false, | |
passes: 5, // 4 was highest number observed to date that results in even smaller code | |
pure_funcs(node) { | |
// noinspection JSUnresolvedVariable | |
return ![ | |
'isObject', | |
'KClass', | |
'KClassImpl', | |
'KClassifier', | |
'Unit', | |
'Unit_getInstance', | |
'getKPropMetadata', | |
'getPropertyCallableRef', | |
'getPropertyRefClass', | |
'propertyRefClassMetadataCache$init$' | |
].includes(node.expression.name) | |
}, | |
pure_getters: true, | |
unsafe: true, | |
unsafe_arrows: true, | |
unsafe_methods: true, | |
unsafe_proto: true, | |
unsafe_symbols: true, | |
}, | |
format: { | |
beautify: false, // 'true' for debugging | |
wrap_func_args: false, | |
wrap_iife: true, | |
}, | |
mangle: { | |
keep_classnames: false, // 'true' for debugging | |
keep_fnames: false, // 'true' for debugging | |
}, | |
}, | |
}), | |
// … |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment