dynamic partials cause (lookupProperty(...) || (depth0 && lookupProperty(...)) || alias3).call is not a function
See original GitHub issueUsed versions: express-handlebars: 5.1.0 handlesbars: 4.7.6
partials is saved in: /views/partials/filename.handlesbars varPartial = ‘filename’;
main template uses
{{> (varPartial)}}
outcome:
TypeError: (lookupProperty(…) || (depth0 && lookupProperty(…)) || alias3).call is not a function at Object.eval [as main] (eval at createFunctionContext (/usr/src/app/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:262:23), <anonymous>:11:148) at main (/usr/src/app/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32) at ret (/usr/src/app/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12) at ret (/usr/src/app/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21) at ExpressHandlebars._renderTemplate (/usr/src/app/node_modules/express-handlebars/lib/express-handlebars.js:253:10) at ExpressHandlebars.render (/usr/src/app/node_modules/express-handlebars/lib/express-handlebars.js:166:21) at async ExpressHandlebars.renderView (/usr/src/app/node_modules/express-handlebars/lib/express-handlebars.js:224:15)
If I use
{{> 'filename'}}
It works
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I was able to resolve it. I registered a helper that was defined in an ESM but required, so it didn’t use
default
.@knownasilya it would be easier to help if you create a new issue and give more details about the code you are trying.