Closed mblataric closed 5 years ago
I don't have an idea. This is related to inlining. Mange options is can only affect renaming. This plugin is a thing wrapper around terser. It's not responsible to any optimisation in a code.
By the way what are you trying to achieve? If you want svg to be a global you can use window.svg =
instead.
I don't have an idea. This is related to inlining. Mange options is can only affect renaming. This plugin is a thing wrapper around terser. It's not responsible to any optimisation in a code.
I understand, I thought maybe not all options are properly passed to terser.
By the way what are you trying to achieve? If you want svg to be a global you can use
window.svg =
instead.
I want to be able to access this variable in html, for instance onclick="svg.SomeFunction()
.
I found working solution with:
compress: {
collapse_vars: false
},
but I guess window.svg could be even better since I get collapsed vars as well, thanks.
Hi,
I am trying out terser plugin, but I need one variable name not to be changed.
First I thought rollup-plugin-typescript2 might be the issue (maybe incorrectly transpile ts file), but I removed it from process (I prepared JS files manually).
In entry JS file I have following code:
Then my rollup.config.js looks like this:
As you can see, I would like svg variable to remain unchanged, but after terser is finished, there is no svg variable anywhere, instead class is initialised like this:
and then at the end:
If I do not use terser plugin, rollup leaves the svg variable and code is like in typescript.
Any idea how to keep original svg declaration? Thanks, Mario