Closed autonordev closed 1 year ago
haveyou try disable cache by setting maxCache
and also use noCache
option of nunjucks (use .options
) in development?
const production = app.config.NODE_ENV === 'production' // false
app.register(require('@fastify/point-of-view'), {
engine: {
nunjucks: require('nunjucks'),
},
templates: [ ... ],
production,
options: {
noCache: !production,
},
})
(maybe we should make this default behavior)
I use this setup and it works fine, so unless there is anything else to add, this issue could be closed
Did you manage to solve this @autonordev?
Hi, sorry for the inactivity here. Happy to confirm that I was able to solve this issue using the instructions provided by trim21.
Prerequisites
Fastify version
4.11.0
Plugin version
7.4.0
Node.js version
18.12.1
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
10 (21H2)
Description
During development, it's expected that templates reload every page request. This means that if the file content has changed since the process begun, the changes would be present on the next page load.
However, it appears that -- at least when using Nunjucks -- this is not occurring, and a reload of the process is needed in order to cause changes to start appearing.
Steps to Reproduce
I've checked and do not have any type of caching plugin running on the project, also any types of changes to locals/data work; it's just the template file where the issue lies.