diff --git a/lib/ember-plugins.js b/lib/ember-plugins.js index 275cfb83..c2b30b1b 100644 --- a/lib/ember-plugins.js +++ b/lib/ember-plugins.js @@ -60,9 +60,13 @@ function _getEmberModulesAPIPolyfill(appRoot, config) { if (_emberVersionRequiresModulesAPIPolyfill()) { const ignore = _getEmberModulesAPIIgnore(appRoot, config); + const useEmberModule = _shouldDeprecateGlobalEmber(appRoot); return [ - [require.resolve("babel-plugin-ember-modules-api-polyfill"), { ignore }], + [ + require.resolve("babel-plugin-ember-modules-api-polyfill"), + { ignore, useEmberModule }, + ], ]; } } @@ -80,6 +84,16 @@ function _shouldIgnoreJQuery(appRoot) { return pkg && semver.gt(pkg.version, "0.6.0"); } +function _shouldDeprecateGlobalEmber(appRoot) { + let packagePath = resolvePackagePath("ember-source", appRoot); + if (packagePath === null) { + return false; + } + + let pkg = require(packagePath); + return pkg && semver.get(pkg.version, "3.26.0-beta.1"); +} + function _emberDataVersionRequiresPackagesPolyfill(appRoot) { let packagePath = resolvePackagePath("ember-data", appRoot); if (packagePath === null) { @@ -128,7 +142,7 @@ function _getEmberDataPackagesPolyfill(appRoot, config) { function _getModuleResolutionPlugins(config) { if (!config.disableModuleResolution) { const resolvePath = require("../lib/relative-module-paths") - .resolveRelativeModulePath; + .resolveRelativeModulePath; return [ [require.resolve("babel-plugin-module-resolver"), { resolvePath }], [