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

Reduce the bundle size #86

Open
richardscarrott opened this issue Feb 26, 2021 · 4 comments
Open

Reduce the bundle size #86

richardscarrott opened this issue Feb 26, 2021 · 4 comments

Comments

@richardscarrott
Copy link

richardscarrott commented Feb 26, 2021

Currently requiring stackdriver-errors-js results in quite a lot of code being pulled in -- it's one of our largest dependencies.

Screenshot 2021-02-26 at 18 55 52

The above is generated using https://github.com/webpack-contrib/webpack-bundle-analyzer.

Stat Size: 136.64KB (before minification)
Parsed Size: 39.06 KB (after minification)
Gzipped: 11.65KB (after minification + gzip)

Although it's not strictly because of code in stackdriver-errors-js, I figured this is a good place to start to get an understanding of what really is required to report errors to stackdriver.

In particular I'd love to find out how important stacktrace-js is to this libraries functionality and whether there are opportunities to cut it or use an alternative dependency -- I wonder if it's supporting very old browsers / edge cases which are no longer relevant to everybody 🤔

I'm tempted to just try to write a simple stackdriver API wrapper without stacktrace-js but of course there's every chance I'll end up going through the exact same process this library went through and realise it's not possible without those large dependencies so any advice is welcome!

@steren
Copy link
Collaborator

steren commented Mar 1, 2021

stacktrace-js is needed for this library as it helps normalize the stacktraces before sending them to the server (stacktraces differ between browsers, e.g. Firefox / Chrome)

if you try to cut it, make sure to test with multiple browsers. We could make it optional (and provide two builds of the library).

@kospl
Copy link
Contributor

kospl commented Mar 27, 2021

+1
also,

var polyfills = [
'core-js/fn/array/filter',
'core-js/fn/array/for-each',
'core-js/fn/array/map',
'core-js/fn/function/bind',
'core-js/fn/promise',
];

currently there are some bundled polyfills for what, like IE 8 ?
https://caniuse.com/?search=array.map

@steren
Copy link
Collaborator

steren commented Mar 29, 2021

I'm definitely supportive of dropping support for old browsers.

@bjon
Copy link
Contributor

bjon commented Oct 14, 2021

@steren Added a PR for this #106

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

4 participants