diff --git a/lib/babel-options-util.js b/lib/babel-options-util.js index ee26306b..108e3d0e 100644 --- a/lib/babel-options-util.js +++ b/lib/babel-options-util.js @@ -91,11 +91,9 @@ function _getDebugMacroPlugins(config, project) { if (_emberVersionRequiresModulesAPIPolyfill(project)) { useModulesVersion = false; - } else if (addonOptions.compileModules === false) { + } else if (addonOptions.compileModules === false && _emberVersionSupportsEmberGlobal(project)) { // we have to use the global form when not compiling modules, because it is often used // in the context of an `app.import` where there is no wrapped in an AMD module - // - // However, you can opt out of this behavior by explicitly specifying `disableDebugTooling` useModulesVersion = disableDebugTooling === false; } else { useModulesVersion = true; @@ -141,6 +139,16 @@ function _emberVersionRequiresModulesAPIPolyfill(project) { return result; } +function _emberVersionSupportsEmberGlobal(project) { + let checker = new VersionChecker(project).for("ember-source", "npm"); + if (!checker.exists()) { + return true; + } + let result = checker.lt("4.0.0-alpha.1"); + + return result; +} + function _emberDataVersionRequiresPackagesPolyfill(project) { let checker = new VersionChecker(project); let dep = checker.for("ember-data"); @@ -165,7 +173,7 @@ function _getEmberModulesAPIPolyfill(config, parent, project) { if (_emberVersionRequiresModulesAPIPolyfill(project)) { useModulesVersion = false; - } else if (addonOptions.compileModules === false) { + } else if (addonOptions.compileModules === false && _emberVersionSupportsEmberGlobal(project)) { // we have to use the global form when not compiling modules, because it is often used // in the context of an `app.import` where there is no wrapped in an AMD module //