-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: Build to ESM for tree shaking (#117)
This PR changes updates our webpack config to use ESM instead of CJS modules so we can actually do tree shaking. The reason for this is our extension failed Chrome's review process due to some third party script loading code from the Sentry SDK. We don't actually use this code and it should be removed from our bundle with tree shaking.
- Loading branch information
1 parent
bcb59cb
commit 5513811
Showing
8 changed files
with
114 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
comment: | ||
require_bundle_changes: True | ||
bundle_change_threshold: "0b" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,35 @@ | ||
import { | ||
breadcrumbsIntegration, | ||
browserApiErrorsIntegration, | ||
BrowserClient, | ||
defaultStackParser, | ||
getDefaultIntegrations, | ||
globalHandlersIntegration, | ||
makeFetchTransport, | ||
dedupeIntegration, | ||
Scope, | ||
} from '@sentry/browser'; | ||
} from "@sentry/browser"; | ||
|
||
// Sentry config | ||
// Browser extensions must initialize Sentry a bit differently to avoid | ||
// Browser extensions must initialize Sentry a bit differently to avoid | ||
// conflicts between Sentry instances should the site the extension is running | ||
// on also use Sentry. Read more here: | ||
// https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/ | ||
|
||
const sentryIntegrations = getDefaultIntegrations({}).filter(defaultIntegration => { | ||
return !['BrowserApiErrors', 'TryCatch', 'Breadcrumbs', 'GlobalHandlers'].includes( | ||
defaultIntegration.name | ||
); | ||
}); | ||
|
||
const sentryClient = new BrowserClient({ | ||
// @ts-ignore SENTRY_DSN is populated by Webpack at build time | ||
dsn: SENTRY_DSN, | ||
transport: makeFetchTransport, | ||
stackParser: defaultStackParser, | ||
integrations: sentryIntegrations, | ||
integrations: [ | ||
breadcrumbsIntegration, | ||
browserApiErrorsIntegration, | ||
globalHandlersIntegration, | ||
dedupeIntegration, | ||
], | ||
}); | ||
|
||
const Sentry = new Scope(); | ||
Sentry.setClient(sentryClient); | ||
sentryClient.init(); | ||
|
||
export default Sentry | ||
export default Sentry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters