Skip to content

Commit

Permalink
[BUGFIX release] Ensure loader.js is transpiled via targets.
Browse files Browse the repository at this point in the history
Since `loader.js` is the "one thing" that does not need modules
transpilation, this also adds a new argument to `transpileTree`. Most of
the time that option is `undefined` (and therefore not used at all), but
for header files we need to avoid the module wrapping.
  • Loading branch information
rwjblue committed Nov 26, 2019
1 parent f6488a6 commit 204cdc8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ module.exports = {
}
},

transpileTree(tree, isProduction) {
transpileTree(tree, isProduction, shouldCompileModules) {
let emberCliBabel = this.addons.find(a => a.name === 'ember-cli-babel');

let parentOptions = this.parent && this.parent.options;
Expand Down Expand Up @@ -158,6 +158,13 @@ module.exports = {
}),
};

if (shouldCompileModules !== undefined) {
// ember-cli-babel internally uses **any** value that was provided IIF
// the option is set so this option must only be set when we have a
// useful value for it
options['ember-cli-babel'].compileModules = shouldCompileModules;
}

if (isProduction) {
options.babel.plugins.push(buildStripClassCallcheckPlugin());
}
Expand All @@ -173,7 +180,11 @@ module.exports = {
isProduction
);

let headerFiles = new Funnel(tree, { srcDir: 'header' });
let headerFiles = this.transpileTree(
new Funnel(tree, { srcDir: 'header' }),
isProduction,
false
);

let exclude = isProduction ? ['ember-testing/**'] : [];

Expand Down

0 comments on commit 204cdc8

Please sign in to comment.