Sentry-javascript: @sentry/node package size is pretty big

Created on 28 May 2019  路  13Comments  路  Source: getsentry/sentry-javascript

:wave: hi there, I'm using Sentry for fatal error reporting on a CLI tool and a lambda server and I'm looking into moving from raven to @sentry/node. However I noticed that the package size has increased from 170kB to 1.7MB.
I'm trying to keep the CLI size down without so the parsing time is low when started, same for the server.

@sentry/node
install size

raven
install size

Inspecting locally the biggest offenders are:

image

Seems like the double dist and esm output does not work in the size favor, thoughts?

Most helpful comment

been lookin into why this hasnt been brought up... so according to webpack bundle visualizer, even after all terser optimizations, the browser version is still one of the biggest deps in our bundle:

Screenshot 2020-05-21 20 33 48

Is there any work being done to reduce this? i just find it hard to believe that the error reporting bundle is nearly as big as react (the core of the app)

All 13 comments

:thought_balloon: One simple opportunity would be to have the promise implementation being passed as input so the consumer can decide if a polyfill is needed.

Using @sentry/browser in a React project and bundling with Parcel, ~102 kB of the bundle (more than 25% of the total size) comes from the Sentry dependency. If there's anything I can do to reduce the size of this dependency, let me know! 馃憤

@denizdogan it's 17.7kB gzipped - https://bundlephobia.com/result?p=@sentry/browser@5.11.2 馃

@kamilogorek That's weird, maybe it's just the way that I use Parcel that's making it this way? Because my output bundle size is 393.07 kB and using a bundle visualizer tool, it looks like @sentry/browser takes 38 kB. Then a bunch of other Sentry libraries (assuming they're dependencies) take up the rest of the 102 kB.

image

@denizdogan can you explain how you visialize this exactly? I can take a look at it if you provide a small repro case

@kamilogorek I've made a small reproduction repository with instructions here: https://github.com/denizdogan/sentry-parcel-bundle-size Thanks!

@denizdogan not sure what's the state of Parcel 1, but I checked and it indeed produces much bigger bundle than let's say Webpack.

However, parcel@next, which is alpha version of v2, works great with basic config:

/sentry/repros/sentry-parcel-bundle-size:(master) 位: ls -alh dist/browser/
-rw-r--r--  1 kamilogorek  staff    58K Jan 30 15:19 index.js
/sentry/repros/sentry-parcel-bundle-size:(master) 位: gzip -9 dist/browser/index.js
/sentry/repros/sentry-parcel-bundle-size:(master) 位: ls -alh dist/browser/
-rw-r--r--  1 kamilogorek  staff    17K Jan 30 15:19 index.js.gz

Add this parcel config to package.json:

  "targets": {
    "browser": {
      "context": "browser",
      "includeNodeModules": true,
      "outputFormat": "global"
    }
  }

npm i parcel@next and then npx parcel@next bundle src/index.js

@kamilogorek I'll just attribute the problem to Parcel 1 then :) Thanks for your help

been lookin into why this hasnt been brought up... so according to webpack bundle visualizer, even after all terser optimizations, the browser version is still one of the biggest deps in our bundle:

Screenshot 2020-05-21 20 33 48

Is there any work being done to reduce this? i just find it hard to believe that the error reporting bundle is nearly as big as react (the core of the app)

I see the same with the browser bundle
image

My sentry is 65KB parsed and gzipped 18kb which is the same as the whole Vue package, and even larger then Vuetify!
Even if it's 18kb gzipped this is about 20% of my application's chunk-venoders/start up javascript
image

image

@ricardovanlaarhoven ditto!

The size is enormous for an error tracking utility
image

Was this page helpful?
0 / 5 - 0 ratings