@@ -60,6 +60,8 @@ module.exports = {
6060 // ensure that broccoli-ember-hbs-template-compiler is not processing hbs files
6161 registry . remove ( 'template' , 'broccoli-ember-hbs-template-compiler' ) ;
6262
63+ let isProduction = process . env . EMBER_ENV === 'production' ;
64+
6365 // when this.parent === this.project, `this.parent.name` is a function 😭
6466 let parentName = typeof this . parent . name === 'function' ? this . parent . name ( ) : this . parent . name ;
6567
@@ -73,7 +75,7 @@ module.exports = {
7375 ) ;
7476
7577 let shouldColocateTemplates = this . _addon . _shouldColocateTemplates ( ) ;
76- let htmlbarsOptions = this . _addon . htmlbarsOptions ( ) ;
78+ let htmlbarsOptions = Object . assign ( { isProduction } , this . _addon . htmlbarsOptions ( ) ) ;
7779
7880 let inputTree = debugTree ( tree , '01-input' ) ;
7981
@@ -87,10 +89,15 @@ module.exports = {
8789 return debugTree ( new TemplateCompiler ( inputTree , htmlbarsOptions ) , '03-output' ) ;
8890 } ,
8991
90- precompile ( string , options ) {
92+ precompile ( string , _options ) {
93+ let options = _options ;
9194 let htmlbarsOptions = this . _addon . htmlbarsOptions ( ) ;
9295 let templateCompiler = htmlbarsOptions . templateCompiler ;
9396
97+ if ( isProduction ) {
98+ options = Object . assign ( { isProduction } , _options ) ;
99+ }
100+
94101 return utils . template ( templateCompiler , string , options ) ;
95102 } ,
96103 } ) ;
@@ -145,6 +152,8 @@ module.exports = {
145152 addonOptions . babel . plugins = addonOptions . babel . plugins || [ ] ;
146153 let babelPlugins = addonOptions . babel . plugins ;
147154
155+ let isProduction = process . env . EMBER_ENV === 'production' ;
156+
148157 // add the babel-plugin-htmlbars-inline-precompile to the list of plugins
149158 // used by `ember-cli-babel` addon
150159 if ( ! utils . isInlinePrecompileBabelPluginRegistered ( babelPlugins ) ) {
@@ -156,7 +165,8 @@ module.exports = {
156165
157166 let htmlbarsInlinePrecompilePlugin = utils . buildParalleizedBabelPlugin (
158167 pluginInfo ,
159- templateCompilerPath
168+ templateCompilerPath ,
169+ isProduction
160170 ) ;
161171
162172 babelPlugins . push ( htmlbarsInlinePrecompilePlugin ) ;
@@ -165,6 +175,7 @@ module.exports = {
165175 this . logger . debug ( 'Prevented by these plugins: ' + pluginInfo . unparallelizableWrappers ) ;
166176
167177 let htmlBarsPlugin = utils . setup ( pluginInfo , {
178+ isProduction,
168179 projectConfig : this . projectConfig ( ) ,
169180 templateCompilerPath,
170181 } ) ;
0 commit comments