Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions lib/babel-options-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -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
//
Expand Down