File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,13 +96,36 @@ module.exports = {
9696 }
9797
9898 this . _addon . logger . debug ( `setup *.hbs compiler with ${ htmlbarsOptions . pluginNames } ` ) ;
99- return debugTree (
99+ let output = debugTree (
100100 this . _addon . transpileTree ( inputTree , {
101101 isProduction,
102102 ...htmlbarsOptions ,
103103 } ) ,
104104 '03-output'
105105 ) ;
106+
107+ let checker = new VersionChecker ( this . _addon . project ) . for ( 'ember-cli' , 'npm' ) ;
108+ let requiresBabelTree = checker . lt ( '3.13.0' ) ;
109+ let isAddon = this . _addon . parent !== this . _addon . project ;
110+
111+ // as a result of https://github.com/ember-cli/ember-cli-htmlbars/pull/749 we are relying
112+ // on babel for all template comilation. This works fine since ember-cli@3.13 but before
113+ // that there was a different path for **addon** templates and they would not be compiled
114+ // correctly. This change wraps the output of addons in a babel tree since ember-cli
115+ // isn't doing that properly.
116+ if ( requiresBabelTree && isAddon ) {
117+ let babelAddon = this . _addon . parent . addons . find (
118+ ( addon ) => addon . name === 'ember-cli-babel'
119+ ) ;
120+ output = babelAddon . transpileTree ( output , {
121+ babel : this . _addon . parent . options . babel ,
122+ 'ember-cli-babel' : {
123+ compileModules : false ,
124+ } ,
125+ } ) ;
126+ }
127+
128+ return output ;
106129 } ,
107130
108131 precompile ( string , _options ) {
You can’t perform that action at this time.
0 commit comments