locals is not defined after upgrading the ejs to the latest version
odaper opened this issue · comments
Mathlouthi Khaled commented
Hello
I'm using the locals to access the variables passed to my ejs templates using yeoman v4 and ejs v2.7, for example:
<% const myParam = locals.myParam; %>
When I upgraded the ejs to the v3.1.7, the locals variables is no more defined.
How can we solve this issue? the locals is no more defined in ejs v3?
Thanks for your help
Matthew Eernisse commented
EJS by default uses with
to set locally scoped versions of the variables you pass. If you want to use the locals
object, you need to set the _with
option to false
. See the docs here: https://ejs.co/
Mathlouthi Khaled commented
Many thanks @mde