Skip to content

Commit

Permalink
fixup! feat: initialize sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyslbw committed Sep 30, 2024
1 parent ba0b6ab commit 2dc1062
Showing 1 changed file with 20 additions and 38 deletions.
58 changes: 20 additions & 38 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,60 +36,42 @@ if (fileSystem.existsSync(secretsPath)) {

const isDevelopment = process.env.NODE_ENV === 'development';

const hasSentryConfig =
process.env.SENTRY_AUTH_TOKEN &&
process.env.SENTRY_ORG &&
process.env.SENTRY_PROJECT

const withMaybeSentry = (p) => hasSentryConfig ? [ path.join(__dirname, 'src', 'features', 'sentry.js'), p ] : [p];

var options = {
devtool: 'source-map',
experiments: {
asyncWebAssembly: true,
},
mode: process.env.NODE_ENV || 'development',
entry: {
mainPopup: [
path.join(__dirname, 'src', 'features', 'sentry.js'),
path.join(__dirname, 'src', 'ui', 'indexMain.jsx')
],
internalPopup: [
path.join(__dirname, 'src', 'features', 'sentry.js'),
path.join(__dirname, 'src', 'ui', 'indexInternal.jsx')
],
hwTab: [
path.join(__dirname, 'src', 'features', 'sentry.js'),
path.join(__dirname, 'src', 'ui', 'app', 'tabs', 'hw.jsx')
],
createWalletTab: [
path.join(__dirname, 'src', 'features', 'sentry.js'),
path.join(
mainPopup: withMaybeSentry(path.join(__dirname, 'src', 'ui', 'indexMain.jsx')),
internalPopup: withMaybeSentry(path.join(__dirname, 'src', 'ui', 'indexInternal.jsx')),
hwTab: withMaybeSentry(path.join(__dirname, 'src', 'ui', 'app', 'tabs', 'hw.jsx')),
createWalletTab: withMaybeSentry(path.join(
__dirname,
'src',
'ui',
'app',
'tabs',
'createWallet.jsx'
)],
trezorTx: [
path.join(__dirname, 'src', 'features', 'sentry.js'),
path.join(__dirname, 'src', 'ui', 'app', 'tabs', 'trezorTx.jsx')
],
background: [
path.join(__dirname, 'src', 'features', 'sentry.js'),
path.join(__dirname, 'src', 'pages', 'Background', 'index.js')
],
contentScript: [
path.join(__dirname, 'src', 'features', 'sentry.js'),
path.join(__dirname, 'src', 'pages', 'Content', 'index.js')
],
injected: [
path.join(__dirname, 'src', 'features', 'sentry.js'),
path.join(__dirname, 'src', 'pages', 'Content', 'injected.js')
],
trezorContentScript: [
path.join(__dirname, 'src', 'features', 'sentry.js'),
path.join(
)),
trezorTx: withMaybeSentry(path.join(__dirname, 'src', 'ui', 'app', 'tabs', 'trezorTx.jsx')),
background: withMaybeSentry(path.join(__dirname, 'src', 'pages', 'Background', 'index.js')),
contentScript: withMaybeSentry(path.join(__dirname, 'src', 'pages', 'Content', 'index.js')),
injected: withMaybeSentry(path.join(__dirname, 'src', 'pages', 'Content', 'injected.js')),
trezorContentScript: withMaybeSentry(path.join(
__dirname,
'src',
'pages',
'Content',
'trezorContentScript.js'
)]
))
},
chromeExtensionBoilerplate: {
notHotReload: ['contentScript', 'devtools', 'injected'],
Expand Down Expand Up @@ -175,13 +157,13 @@ var options = {
},
plugins: [
...(isDevelopment ? [new ReactRefreshWebpackPlugin()] : []),
sentryWebpackPlugin({
...(hasSentryConfig ? [sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
telemetry: false,
url: 'https://sentry.io/'
}),
})] : []),
new webpack.BannerPlugin({
banner: () => {
return 'globalThis.document={getElementsByTagName:()=>[],createElement:()=>({ setAttribute:()=>{}}),head:{appendChild:()=>{}}};';
Expand Down

0 comments on commit 2dc1062

Please sign in to comment.