-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (34 loc) · 989 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
32
33
34
35
36
37
38
39
40
41
42
43
/* jshint node: true */
/* eslint-env node */
'use strict';
const mergeTrees = require('broccoli-merge-trees');
const path = require('path');
const WebpackWriter = require('broccoli-webpack');
module.exports = {
name: 'redux-pack',
included(app) {
// see: https://github.com/ember-cli/ember-cli/issues/3718
if (typeof app.import !== 'function' && app.app) {
app = app.app;
}
app.import('vendor/redux-pack.amd.js');
},
treeForVendor(tree) {
const rPackPath = path.dirname(require.resolve('redux-pack'));
const rPackTree = new WebpackWriter([ rPackPath ], {
entry: './index.js',
output: {
library: 'redux-pack',
libraryTarget: 'amd',
filename: 'redux-pack.amd.js'
}
});
if (!tree) {
return this._super.treeForVendor.call(this, rPackTree);
}
const trees = mergeTrees([rPackTree, tree], {
overwrite: true
});
return this._super.treeForVendor.call(this, trees);
}
};