Skip to content

Commit 27271d8

Browse files
committed
Use @embroider/macros instead of runInDebug for @sentry/ember
This ensures that the debug code is actually stripped from production builds.
1 parent 4a11356 commit 27271d8

File tree

3 files changed

+222
-44
lines changed

3 files changed

+222
-44
lines changed

packages/ember/addon/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as Sentry from '@sentry/browser';
22
import { addGlobalEventProcessor, SDK_VERSION, BrowserOptions } from '@sentry/browser';
33
import environmentConfig from 'ember-get-config';
4-
4+
import { macroCondition, isDevelopingApp } from '@embroider/macros';
55
import { next } from '@ember/runloop';
6-
import { assert, warn, runInDebug } from '@ember/debug';
6+
import { assert, warn } from '@ember/debug';
77
import Ember from 'ember';
88
import { timestampWithMs } from '@sentry/utils';
99

@@ -22,7 +22,7 @@ export function InitSentryForEmber(_runtimeConfig: BrowserOptions | undefined) {
2222

2323
Sentry.init(initConfig);
2424

25-
runInDebug(() => {
25+
if (macroCondition(isDevelopingApp())) {
2626
if (config.ignoreEmberOnErrorWarning) {
2727
return;
2828
}
@@ -35,7 +35,7 @@ export function InitSentryForEmber(_runtimeConfig: BrowserOptions | undefined) {
3535
},
3636
);
3737
});
38-
});
38+
}
3939
}
4040

4141
export const getActiveTransaction = () => {

packages/ember/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@
3131
"pack": "npm pack"
3232
},
3333
"dependencies": {
34+
"@embroider/macros": ">= 0.25.0",
3435
"@sentry/browser": "5.24.2",
3536
"@sentry/tracing": "5.24.2",
3637
"@sentry/types": "5.24.2",
3738
"@sentry/utils": "5.24.2",
39+
"@types/babel__core": "^7.1.9",
3840
"ember-auto-import": "^1.6.0",
3941
"ember-cli": "^3.21.2",
4042
"ember-cli-babel": "^7.20.5",

0 commit comments

Comments
 (0)