Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why include terser? #2

Open
estrattonbailey opened this issue Jan 24, 2019 · 9 comments
Open

Why include terser? #2

estrattonbailey opened this issue Jan 24, 2019 · 9 comments

Comments

@estrattonbailey
Copy link

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.

@advance512
Copy link

@estrattonbailey
Can you offer some data to back this up?
How much weight does it add to the payload?

@estrattonbailey
Copy link
Author

@advance512 according to Bundlephobia, 82.9% of its 364.4kb (minified) payload is Terser.

@advance512
Copy link

@henning @thebarty
Any thoughts on this?
Can we not include terser?

@henning
Copy link

henning commented Jun 3, 2019

No idea. Do what you like @advance512

@estrattonbailey
Copy link
Author

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.

@advance512
Copy link

@estrattonbailey
Mind sharing what you ended up doing instead?

@thebarty thebarty closed this as completed Jun 4, 2019
@iggyvanlith
Copy link

iggyvanlith commented Aug 2, 2019

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.

@imjared
Copy link
Contributor

imjared commented Sep 4, 2019

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.

image

@thebarty
Copy link
Owner

thebarty commented Sep 5, 2019

PRs are very welcome!

Let's make this package better and better together

@thebarty thebarty reopened this Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants