Closed fangxu864 closed 1 year ago
The same with me, the cache is not found. Can you check on that, @titanism?
Please provide a working example or a test that demonstrates this is a bug.
This occurs for me with @koa/ejs@5.0.0
when using cache + layout.
Using the example code with cache: true
and a simple layout template:
<%- body %>
The first render is successful but subsequent calls throw:
ReferenceError: body is not defined
at eval (eval at compile (/tmp/koa-ejs-cache-issue/node_modules/ejs/lib/ejs.js:673:12), <anonymous>:6:17)
at Object.template [as /tmp/koa-ejs-cache-issue/view/template.html] (/tmp/koa-ejs-cache-issue/node_modules/ejs/lib/ejs.js:703:17)
at render (/tmp/koa-ejs-cache-issue/node_modules/@koa/ejs/index.js:79:66)
at app.context.render (/tmp/koa-ejs-cache-issue/node_modules/@koa/ejs/index.js:108:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /tmp/koa-ejs-cache-issue/index.js:15:3
I have encountered the same problem
line79 if (settings.cache && cache[viewPath]) return cache[viewPath](options.scope, options)
should be
return cache[viewPath].call()