@@ -156,12 +156,13 @@ const EMBER_ADDON: AddonImplementation<CSSBlocksApplicationAddon> = {
156
156
// tslint:disable-next-line:prefer-unknown-to-any
157
157
let lazyAddons = this . project . addons . filter ( ( a : any ) => a . lazyLoading && a . lazyLoading . enabled === true ) ;
158
158
let jsOutputTrees = lazyAddons . map ( ( a ) => {
159
- // XXX I have no idea how engines will work with embroider.
160
- // XXX This code assumes that lazy engines are always compiled
161
- // XXX at the same time as the application (not precompiled).
159
+ // This won't work with embroider in (at least) the case of
160
+ // precompiled ember engines. We need the intermediate build structure
161
+ // of the addon to include the files I output from template
162
+ // compilation.
163
+ let addon = a . addons . find ( ( child ) => child . name === "@css-blocks/ember" ) ;
162
164
// tslint:disable-next-line:prefer-unknown-to-any
163
- let publicTree = ( < any > a ) . treeForPublic ( ) ;
164
- return findCssBlocksTemplateOutputTree ( publicTree . inputNodes ) ;
165
+ return addon && ( < any > addon ) . templateCompiler ;
165
166
} ) . filter ( Boolean ) ;
166
167
let lazyOutput = funnel ( mergeTrees ( jsOutputTrees ) , { destDir : "lazy-tree-output" } ) ;
167
168
this . broccoliAppPluginInstance = new CSSBlocksApplicationPlugin ( env . modulePrefix , [ env . app . addonTree ( ) , tree , lazyOutput ] , env . config ) ;
@@ -195,22 +196,4 @@ interface MaybeCSSBlocksTreePlugin {
195
196
isCssBlocksTemplateCompiler : boolean | undefined ;
196
197
}
197
198
198
- function findCssBlocksTemplateOutputTree ( trees : Array < MaybeCSSBlocksTree > ) : MaybeCSSBlocksTree | null {
199
- for ( let tree of trees ) {
200
- if ( typeof tree === "object" && tree . isCssBlocksTemplateCompiler === true ) {
201
- return tree ;
202
- }
203
- }
204
- for ( let tree of trees ) {
205
- if ( typeof tree === "object" && tree . _inputNodes ) {
206
- let found = findCssBlocksTemplateOutputTree ( tree . _inputNodes ) ;
207
- if ( found !== null ) {
208
- return found ;
209
- }
210
- }
211
- }
212
- return null ;
213
- }
214
-
215
- // Aaaaand export the addon implementation!
216
199
module . exports = EMBER_ADDON ;
0 commit comments