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

Refactor @bugsnag/browser #2252

Draft
wants to merge 38 commits into
base: integration/typescript
Choose a base branch
from

Conversation

gingerbenw
Copy link
Member

@gingerbenw gingerbenw commented Nov 12, 2024

Goal

This PR converts the last of the internal browser plugins and the browser client to TypeScript, using Rollup to bundle both common js and es modules

Following this work, we can then validate a flattened module (fesm) with a modern angular app

Design

Changeset

Testing

Existing test suite

@gingerbenw gingerbenw force-pushed the integration/typescript branch from 9a4591e to 7bbbff9 Compare December 5, 2024 16:04
@gingerbenw gingerbenw changed the title Plat 12163/browser Refactor @bugsnag/browser Dec 5, 2024
Copy link

github-actions bot commented Dec 10, 2024

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 46.15 kB 13.86 kB
After 48.88 kB 15.14 kB
± ⚠️ +2,723 bytes ⚠️ +1,283 bytes

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against 21f1b38

@@ -49,7 +49,9 @@ module.exports = {
'plugin-simple-throttle',
'plugin-console-breadcrumbs',
'plugin-browser-session'
]),
], {
setupFiles: ['<rootDir>/jest/setup/mockEventTarget.js']
Copy link
Contributor

Choose a reason for hiding this comment

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

See jsdom/jsdom#2156

This is needed to fix the TypeError: 'addEventListener' called on an object that is not a valid instance of EventTarget. seen in the integration tests following the rollup changes

Comment on lines 34 to 35
"build:dist": "cross-env NODE_ENV=production bash -c '../../bin/bundle src/notifier.js --standalone=Bugsnag | ../../bin/extract-source-map dist/bugsnag.js'",
"build:dist:min": "cross-env NODE_ENV=production bash -c '../../bin/bundle src/notifier.js --standalone=Bugsnag | ../../bin/minify dist/bugsnag.min.js'",
Copy link
Contributor

Choose a reason for hiding this comment

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

can these be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep - and possibly the minification scripts, too?

@@ -52,7 +52,7 @@ describe('browser notifier', () => {
load: client => 10
}]
})
expect(Bugsnag.getPlugin('foobar')).toBe(10)
expect(Bugsnag.getPlugin?.('foobar')).toBe(10)
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO: Fix

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