diff --git a/index.js b/index.js index 97b39f6c..9f8a14ea 100644 --- a/index.js +++ b/index.js @@ -223,7 +223,7 @@ module.exports = { options.presets = [ shouldRunPresetEnv && this._getPresetEnvPlugins(addonProvidedConfig), - ] + ].filter(Boolean); if (shouldCompileModules) { options.moduleIds = true; diff --git a/node-tests/addon-test.js b/node-tests/addon-test.js index ea37ad68..103b3d10 100644 --- a/node-tests/addon-test.js +++ b/node-tests/addon-test.js @@ -791,6 +791,24 @@ describe('ember-cli-babel', function() { expect(result.plugins).to.deep.include(plugin); }); + it('sets `presets` to empty array if `disablePresetEnv` is true', function() { + let options = { + 'ember-cli-babel': { + disablePresetEnv: true, + } + }; + this.addon.parent = { + options: { + babel6: { + plugins: [ {} ] + }, + }, + }; + + let result = this.addon.buildBabelOptions(options); + expect(result.presets).to.deep.equal([]); + }); + it('user plugins are before preset-env plugins', function() { let plugin = function Plugin() {}; this.addon.parent = {