Skip to content

Commit bb83006

Browse files
authored
fix(ember): Fix backwards compatibility with Embroider changes (#3230)
* fix(ember): Fix backwards compatibility with Embroider changes Switching from ember-get-config to macros introduced a regression for the classic build system, since Embroider injects runtime config differently depending on whether the app is using embroider for it's build system or not. This will grab the config and add it in the included hook when building the addon and including it in an app if embroider is not detected.
1 parent 02d0ded commit bb83006

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

packages/ember/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ module.exports = {
1616
},
1717
},
1818

19+
getAddonConfig(app) {
20+
let config = {};
21+
try {
22+
config = require(app.options.configPath)(app.env);
23+
} catch(_) {
24+
// Config not found
25+
}
26+
return config['@sentry/ember'] || {};
27+
},
28+
29+
included() {
30+
this._super.included.apply(this, arguments);
31+
const app = this._findHost(this);
32+
if (!('@embroider/core' in app.dependencies())) {
33+
const addonConfig = this.getAddonConfig(app);
34+
const options = Object.assign({}, addonConfig);
35+
this.options['@embroider/macros'].setOwnConfig.sentryConfig = options;
36+
}
37+
},
38+
1939
contentFor(type, config) {
2040
const addonConfig = config['@sentry/ember'] || {};
2141
const app = this._findHost(this);

packages/ember/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
"devDependencies": {
4646
"@ember/optional-features": "^1.3.0",
4747
"@embroider/compat": "^0.35.1",
48-
"@embroider/core": "^0.35.1",
49-
"@embroider/webpack": "^0.35.1",
5048
"@glimmer/component": "^1.0.0",
5149
"@glimmer/tracking": "^1.0.0",
5250
"@sentry-internal/eslint-config-sdk": "6.0.4",

0 commit comments

Comments
 (0)