-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
32 lines (26 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
module.exports = {
name: require('./package').name,
included(app, parentAddon) {
this._super.included.apply(this, arguments);
// Quick fix for add-on nesting
// https://github.com/aexmachina/ember-cli-sass/blob/v5.3.0/index.js#L73-L75
// see: https://github.com/ember-cli/ember-cli/issues/3718
while (typeof app.import !== 'function' && (app.app || app.parent)) {
app = app.app || app.parent;
}
// if app.import and parentAddon are blank, we're probably being consumed by an in-repo-addon
// or engine, for which the "bust through" technique above does not work.
if (typeof app.import !== 'function' && !parentAddon) {
if (app.registry && app.registry.app) {
app = app.registry.app;
}
}
if (!parentAddon && typeof app.import !== 'function') {
throw new Error('@html-next/flexi-config is being used within another addon or engine and is'
+ ' having trouble registering itself to the parent application.');
}
this.app = app;
return app;
}
};