elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.62k stars 8.22k forks source link

"Buffer" polyfill bloats plugin bundles #107280

Closed Dosant closed 4 months ago

Dosant commented 3 years ago

When Buffer is used in client or common code, webpack bundles a costly ~30kb polyfill. Looks like it does it per each plugin where Buffer is used. In some cases, it is possible to avoid using it in clientside code altogether, but probably we at least could share the Buffer polyfill across plugins.

Screen Shot 2021-07-30 at 13 07 17

Some clientside usages I found:

elasticmachine commented 3 years ago

Pinging @elastic/kibana-operations (Team:Operations)

elasticmachine commented 3 years ago

Pinging @elastic/kibana-core (Team:Core)

elasticmachine commented 3 years ago

Pinging @elastic/kibana-app-services (Team:AppServices)

afharo commented 2 years ago

While I agree that we should avoid using it, I created https://github.com/elastic/kibana/pull/130877 to move those polyfills to the UI Shared Deps.

pgayvallet commented 2 years ago

@afharo with the polyfills being included in the shared deps, should we close this issue?

afharo commented 2 years ago

I wonder if we should keep it open to actually avoid using them and remove them from the shared deps. What do you think?

elasticmachine commented 2 years ago

Pinging @elastic/kibana-presentation (Team:Presentation)

elasticmachine commented 2 years ago

Pinging @elastic/fleet (Team:Fleet)

elasticmachine commented 2 years ago

Pinging @elastic/security-solution (Team: SecuritySolution)

elasticmachine commented 2 years ago

Pinging @elastic/uptime (Team:uptime)

elasticmachine commented 2 years ago

Pinging @elastic/kibana-gis (Team:Geo)

afharo commented 2 years ago

@pgayvallet I just ran an audit of all the places where it's used and pinged all the teams. If we think the effort is not worth it for reducing 40kB of page bundle load. I'd vote for closing the issue. @elastic/kibana-operations what do you think?

spalger commented 2 years ago

If we can get the work done to remove the buffer usage we could prevent it from being re-added with some basic Webpack config changed.

pgayvallet commented 4 months ago

@afharo agreed, let's close this.