Skip to content

Conversation

djskinner
Copy link

@djskinner djskinner commented Jan 21, 2025

Goal

Convert @bugsnag/node to TypeScript and bundle with rollup, replacing the browserify bundling.

Design

Consistency with new approach to other packages. Needed doing before the @bugsnag/core conversion because browserify does not understand package.exports (see #2296).

Testing

e2e tests passing

@djskinner djskinner changed the title node: TypesScript and rollup node: TypeScript and rollup Jan 22, 2025
Copy link

github-actions bot commented Jan 22, 2025

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 50.02 kB 15.41 kB
After 50.02 kB 15.41 kB
± No change No change

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against 697fc01

Base automatically changed from plat-13423 to integration/typescript January 23, 2025 08:20
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
__BUGSNAG_NOTIFIER_VERSION__: JSON.stringify(packageJson.version),
__BUGSNAG_NOTIFIER_VERSION__: packageJson.version,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted how the version handling is done across all packages because I'd misunderstood how it was working. As can be seen below the version is injected inside a string rather than as a variable. This is how it was done before. The problem with it being a variable is that outside of rollup you can't import or require the file without somehow defining the global variable first. This is done in some of the integration tests for example.

{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["jest", "node"],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned before, the root tsconfig.json has "types: ["jest"], which excludes other types - but we need @types/node here hence why it is redefined.

It would be better to remove "types: ["jest"] from the root tsconfig.json but doing so means that @types/react-native are also included, which then conflict with lib dom, as defined by "lib": [ "dom", "esnext" ],.

So to do that we'll need to restructure the way jest / typescript is set up. One for a later PR.

@djskinner djskinner marked this pull request as ready for review February 3, 2025 15:17
@djskinner djskinner requested a review from gingerbenw February 3, 2025 15:18
@djskinner djskinner merged commit c8b341d into integration/typescript Feb 11, 2025
56 checks passed
@djskinner djskinner deleted the dash-13423-2 branch February 11, 2025 08:08
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

Successfully merging this pull request may close these issues.

2 participants