Open estrattonbailey opened 5 years ago
@estrattonbailey Can you offer some data to back this up? How much weight does it add to the payload?
@advance512 according to Bundlephobia, 82.9% of its 364.4kb (minified) payload is Terser.
@Henning @thebarty Any thoughts on this? Can we not include terser?
No idea. Do what you like @advance512
I'm fairly positive that this library doesn't need a AST parser embedded inside it :P
I don't actually have a need for this anymore, so I'm gonna duck out ✌️ good luck y'all.
@estrattonbailey Mind sharing what you ended up doing instead?
For anybody else looking for a solution for this:
What I did is to write a simple Node script that outputs the generated javascript file and runs before your build. The renderAnalytics
function is perfect for this. It's basically just executing that function and then writing it to a file.
Put it in a gist:
https://gist.github.com/iggyvanlith/167b2d196c20a6abb71ea0f7482020a0
Saved some 100's of kb's from my application.
Ran a bundle analyzer this morning and Terser is by far the biggest part of our clientside build. Seems to totally defeat the point of minification/obfuscation of the analytics snippet since it adds 94kb (gzipped!) in the name of saving what's probably a few bytes.
I'm pretty swamped at the moment but would consider sending a PR to remove if it's open for consideration.
PRs are very welcome!
Let's make this package better and better together
Hey there, thanks for the lib and the original blog post. Seams like a pretty solid option!
However, I'm curious why you chose to include terser to minify the snippet code. It adds considerable weight to the overall payload of this library, and looks like it could easily do without.