Skip to content

Commit 2097045

Browse files
committed
fix(ember): resolve config path from app root
This should aid in resolving the app configuration from the right location. Previously, it was calling `require` with a relative path from the `index.js` file of the Sentry addon itself. This broke trying to actually load the configuration file in _other_ addons that might include this as a dependency. By resolving the config path relative to the app root first, we can correctly load the file even when `@sentry/ember` is used within another addon.
1 parent d8ecb2b commit 2097045

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/ember/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
const fs = require('fs');
3+
const { resolve } = require('path');
34

45
function readSnippet(fileName) {
56
return `<script>${fs.readFileSync(`${__dirname}/vendor/${fileName}`, 'utf8')}</script>`;
@@ -19,7 +20,8 @@ module.exports = {
1920
getAddonConfig(app) {
2021
let config = {};
2122
try {
22-
config = require(app.options.configPath)(app.env);
23+
const fullConfigPath = resolve(app.project.root, app.options.configPath);
24+
config = require(fullConfigPath)(app.env);
2325
} catch(_) {
2426
// Config not found
2527
}

0 commit comments

Comments
 (0)