File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ class TemplateContent {
36
36
this . inputPath = inputPath ;
37
37
}
38
38
39
+ async asyncTemplateInitialization ( ) {
40
+ if ( ! this . hasTemplateRender ( ) ) {
41
+ await this . getTemplateRender ( ) ;
42
+ }
43
+ }
44
+
39
45
resetCachedTemplate ( { eleventyConfig } ) {
40
46
this . eleventyConfig = eleventyConfig ;
41
47
}
Original file line number Diff line number Diff line change @@ -149,14 +149,16 @@ class TemplateMap {
149
149
150
150
// TODO(slightlyoff): major bottleneck
151
151
async initDependencyMap ( dependencyMap ) {
152
- // Temporary workaround for `templateRender` sync references
152
+ // Temporary workaround for async constructor work in templates
153
153
let inputPathSet = new Set ( dependencyMap ) ;
154
154
await Promise . all (
155
- this . map . map ( ( { inputPath, template } ) => {
156
- if ( inputPathSet . has ( inputPath ) ) {
157
- return template . getTemplateRender ( ) ;
158
- }
159
- } ) ,
155
+ this . map
156
+ . filter ( ( { inputPath } ) => {
157
+ return inputPathSet . has ( inputPath ) ;
158
+ } )
159
+ . map ( ( { template } ) => {
160
+ return template . asyncTemplateInitialization ( ) ;
161
+ } ) ,
160
162
) ;
161
163
162
164
for ( let depEntry of dependencyMap ) {
You can’t perform that action at this time.
0 commit comments