-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.js
31 lines (24 loc) · 834 Bytes
/
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
'use strict';
const { resolve } = require('path');
const { hasPlugin, addPlugin } = require('ember-cli-babel-plugin-helpers');
module.exports = {
name: require('./package').name,
included(parent) {
this._super.included.apply(this, arguments);
// this adds our babel plugin to our parent package
this.addBabelPlugin(parent);
// this ensures our parent package can process macros, since our babel
// plugin emits macros
if (!this.parent.addons.find((a) => a.name === '@embroider/macros')) {
this.addons
.find((a) => a.name === '@embroider/macros')
.installBabelPlugin(parent);
}
},
addBabelPlugin(parent) {
let pluginPath = resolve(__dirname, './lib/transpile-modules.js');
if (!hasPlugin(parent, pluginPath)) {
addPlugin(parent, pluginPath);
}
},
};