It seems like whenever my process.NODE_ENV
is set to production
, EJS templating engine will cache all my .html files. So any modifications in those files will not be displayed, unless server restarts.
app.engine('.html', require('ejs').__express);
Is there a way to disable caching template on express? Thanks!
It seems like this is set explicitly as part of express
's built-in code
if (env === 'production') {
this.enable('view cache');
}
This gets called by app.init
which is called by createApplication
which is the function that gets exported and what you probably are calling with app = express()
. You can immediately disable the caching on your own:
app = express();
app.disable('view cache');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With