-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
index.js
35 lines (26 loc) · 1.07 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
33
34
35
'use strict';
module.exports = {
name: require('./package').name,
included(app) {
this._super.included.apply(this, arguments);
let addonOptions = app.options['ember-cli-terser'];
if ('ember-cli-uglify' in app.options) {
this.ui.writeWarnLine('[ember-cli-terser] Passing options as `ember-cli-uglify` in `ember-cli-build.js` is deprecated, please update to passing `ember-cli-terser` (with a `terser` property) instead.');
addonOptions = Object.assign({}, app.options['ember-cli-uglify'], { terser: app.options['ember-cli-uglify'].uglify, uglify: undefined });
}
const { buildTerserOptions } = require('./lib/build-terser-options');
this._terserOptions = buildTerserOptions({
appEnv: app.env,
appSourceMaps: app.options.sourcemaps,
userOptions: addonOptions,
});
},
postprocessTree(type, tree) {
if (this._terserOptions.enabled === true && type === 'all') {
const Terser = require('broccoli-terser-sourcemap');
return new Terser(tree, this._terserOptions);
} else {
return tree;
}
}
};