chore(deps): Remove `tslib` dependency
NOTE: Though most of the the problems the change causes have been solved, I'm leaving this in draft form until I can figure out why the tracePropogationTargets tests (and only the tracePropogationTargets tests) consistently fail. Very mysterious...
Now that we use Sucrase and Rollup for transpiling in our main build process, we no longer need tslib as a runtime dependency. (Sucrase and Rollup have their own ES6 polyfills, which we vendor.)
We do still use tsc when creating ES5 bundles, but we do so through rollup-plugin-typescript-2, which includes tslib among its own dependencies.
We've also been using it (indirectly) in our tests. ts-jest works by transpiling relevant TS files on the fly before running jest, and it's set to use the local tsconfig.test.json when it does so. Because all of our tsconfig files inherit from the tsconfig in @sentry/typescript, they've all been running with importHelpers set to true, which makes our testing dependent on tslib. But since we have no other reason to depend on tslib (and since we obviously don't care about bundle size when it comes to the temporary files ts-jest creates), it's fine to let TS just include the helper implementations alongside their use. Thus we can turn importHelpers off , which means we no longer need tslib as a direct dev dependency, either.
This therefore removes it from our dependencies, both at the repo and package levels.
Notes:
-
The change to
importHelpersis done at the repo level, rather than being done directly in@sentry/typescript, because other packages (likesentry-capacitorandcraft, among others) also depend on@sentry/typescript(and use our old build infrastructure, which needed the setting). -
An old test testing for the inclusion of
tslibcode in our build files, and theskipFilessetting in one of ourlaunch.jsonprofiles have also been removed, as they are now moot.
size-limit report 📦
| Path | Size |
|---|---|
| @sentry/browser - ES5 CDN Bundle (gzipped + minified) | 19.51 KB (0%) |
| @sentry/browser - ES5 CDN Bundle (minified) | 60.26 KB (0%) |
| @sentry/browser - ES6 CDN Bundle (gzipped + minified) | 18.1 KB (-0.02% 🔽) |
| @sentry/browser - ES6 CDN Bundle (minified) | 53.18 KB (0%) |
| @sentry/browser - Webpack (gzipped + minified) | 19.89 KB (0%) |
| @sentry/browser - Webpack (minified) | 64.59 KB (0%) |
| @sentry/react - Webpack (gzipped + minified) | 19.92 KB (0%) |
| @sentry/nextjs Client - Webpack (gzipped + minified) | 44.83 KB (0%) |
| @sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) | 26.03 KB (-0.01% 🔽) |
| @sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) | 24.41 KB (-0.01% 🔽) |
This pull request has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
🥺
Maybe one day we'll get back to this, but it might be easier to try upgrading TS before we do.