Closed Dosant closed 4 months ago
Pinging @elastic/kibana-operations (Team:Operations)
Pinging @elastic/kibana-core (Team:Core)
Pinging @elastic/kibana-app-services (Team:AppServices)
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.
@afharo with the polyfills being included in the shared deps, should we close this issue?
I wonder if we should keep it open to actually avoid using them and remove them from the shared deps. What do you think?
Pinging @elastic/kibana-presentation (Team:Presentation)
Pinging @elastic/fleet (Team:Fleet)
Pinging @elastic/security-solution (Team: SecuritySolution)
Pinging @elastic/uptime (Team:uptime)
Pinging @elastic/kibana-gis (Team:Geo)
@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?
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.
@afharo agreed, let's close this.
When
Buffer
is used in client or common code, webpack bundles a costly ~30kb polyfill. Looks like it does it per each plugin whereBuffer
is used. In some cases, it is possible to avoid using it in clientside code altogether, but probably we at least could share theBuffer
polyfill across plugins.Some clientside usages I found:
global.Buffer
to avoid webpack from polyfilling it) https://github.com/elastic/kibana/blob/4584a8b570402aa07832cf3e5b520e5d2cfa7166/x-pack/plugins/fleet/common/services/is_valid_namespace.ts#L39common
dir. Is it actually used in the Browser?) https://github.com/elastic/kibana/blob/9bf488e8261196ea48a43fad25c2cc1c9395f5a1/x-pack/plugins/lists/common/schemas/request/import_list_item_schema.mock.ts#L19-L21