Skip to content

Commit fd1614a

Browse files
committed
fix(gatsby): Use import for gatsby-browser.js instead of require
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.
1 parent de51011 commit fd1614a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/gatsby/gatsby-browser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-console */
2-
const Sentry = require('@sentry/gatsby');
2+
import { init } from '@sentry/gatsby';
33

44
exports.onClientEntry = function (_, pluginParams) {
55
const isIntialized = isSentryInitialized();
@@ -24,7 +24,7 @@ exports.onClientEntry = function (_, pluginParams) {
2424
return;
2525
}
2626

27-
Sentry.init({
27+
init({
2828
// eslint-disable-next-line no-undef
2929
dsn: __SENTRY_DSN__,
3030
...pluginParams,

0 commit comments

Comments
 (0)