Open mydea opened 1 year ago
Update for this issue: We dropped the build-related polyfills, so the remaining ones are the nullish coalesce & optional chaining ones.
It looks like we can drop the polyfills entirely for @sentry/node
and @sentry/profiling-node
and @sentry/bun
So we did some refactors, but we still have https://github.com/getsentry/sentry-javascript/tree/develop/packages/utils/src/buildPolyfills left. Can we safely remove this?
Honestly I think at this stage we'll simply remove this once we update support policy to not need polyfills for optional chaining etc anymore 😬
Currently, we include a few polyfills in our build:
These are a bit tricky, increase complexity and build size.
These can be split into two categories:
The first category is actually disallowed by eslint rules, as the polyfills increase bundle size considerably when used. We do not use any nullish coalesce/optional chaining in all core/browser SDKs, only in node & nextjs.
I propose to remove these polyfills in v8, if we decide to bump the min. Node version to 14+. Node 14 supports both nullish coalescing as well as optional chaining.
I propose to leave the eslint rules for core/browser SDKs in place, but simply rely on them to ensure we don't use them outside of node context. We also have tests covering that the ES5 CDN bundles are valid ES5, which should cover any regressions there. This allows us to get rid of these polyfills:
The other category of polyfills:
I propose we investigate if we can solve this with rollup instead.
Benefits of dropping the polyfills
@sentry/utils/esm/buildPolyfills/index.js
which is not ideal)