Skip to content

fix(gatsby): Use import for gatsby-browser.js instead of require #7889

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

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Apr 18, 2023

It seems that due to the require usage there, treeshaking is not working as expected. Just replacing this with using esm import seems to resolve this. I tried this in sentry-docs and a reproduction app and it seemed good to me.

Fixes #7853

@mydea mydea added Type: Bug Package: gatsby Issues related to the Sentry Gatsby SDK labels Apr 18, 2023
@mydea mydea requested a review from AbhiPrasad April 18, 2023 14:27
@mydea mydea self-assigned this Apr 18, 2023
It seems that due to the `require` usage there, treeshaking is not working as expected. Just replacing this with using esm `import` seems to resolve this. I tried this in sentry-docs and a reproduction app and it seemed good to me.
@mydea mydea force-pushed the fn/gatsby-use-import branch from fd1614a to 2a5e2b3 Compare April 18, 2023 16:09
@AbhiPrasad
Copy link
Member

Seems to work fine in a gatsby v2 app from my testing - so I think lets ship and see what happens!

@mydea mydea merged commit 36d6630 into develop Apr 19, 2023
@mydea mydea deleted the fn/gatsby-use-import branch April 19, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: gatsby Issues related to the Sentry Gatsby SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@sentry/gatsby massively increases bundle size
2 participants