apm-agent-rum-js icon indicating copy to clipboard operation
apm-agent-rum-js copied to clipboard

Decrease bundle size

Open andriijas opened this issue 3 years ago • 2 comments

the apm rum agent is one of the largest dependencies we use in our app.

Would it be possible to set a goal to shave the yak for future releases? 🐐

https://bundlephobia.com/package/@elastic/[email protected]

Thanks!🙏

andriijas avatar Oct 06 '22 15:10 andriijas

Hi @andriijas,

Thanks for raising this issue!

We have had a few conversations about this and there are plans and ideas in mind to achieve what you are commenting for future releases (more likely in 6.x releases) 👍

If you don't mind, I would like to ask you a few questions:

  • do you have any specific goal in mind? "The package shouldn't be bigger than [placeholder for number or range] because of [reason/list of reasons]"
  • Unless is confidential, could you give us the name of the top 3 largest dependencies you are using? (name & size)

I understand that maybe it's not possible for you to answer these questions, so please, skip if inconvenient 🙏

Many thanks, Alberto

devcorpio avatar Oct 10 '22 15:10 devcorpio

Thanks alberto for taking time to listen and not close down the issue (as they did over at signalR 😅)

As most js applications, we are fighting bundle size continuously trying to get more nimble and also looking at moving to SSR to ship less script to end user. As you can see in the attached screenshot from webpack bundle analyzer the elastic agent is up their with the oidc client and some other packages.

If every dependency we use could drop a kb it would have big impact. Hard to set specific goals on size.

Things you can work with is:

  • Is the code tree shakeable?
  • Can tree shaking drop parts of the agent that is not used when building? For example one project might use some apm featuers that another project is not using. If the output can be tailored for each project then thats a nice optimisation.
Screenshot 2022-10-10 at 18 02 12

Thanks!

andriijas avatar Oct 10 '22 16:10 andriijas