Closed fengb closed 7 years ago
Hi,
You can update nodemon.json
to set NODE_ENV
to development
and enable or not caching based on that.
https://github.com/remy/nodemon/blob/be5d4e8d13a6dcc16c65b5bce59edef54496a8ae/doc/sample-nodemon.md
I tried that but the performance was similar to before the explicit cache enable.
Oh, this cache should be enabled for daemon mode, which doesn't use nodemon:
<array>
<string>/opt/nodes/7.6.0/bin/node</string>
<string>/Users/fengb/.config/yarn/global/node_modules/hotel/lib/daemon</string>
</array>
I see, actually if it's too complicated I wouldn't bother too much.
Even though it's a nice catch :+1:, the benefit is just 0.02
seconds which is unnoticeable and the daemon is just run locally. For a public website it would definitely make sense though.
I'm curious if this can work?
// daemon-prod.js
process.env.NODE_ENV = 'production'
require('./') // src/daemon/index.js
My intent is to speed up proxied requests. I believe the browser will hit the proxy on every request so the 20-30ms will add up:
Actually, I remember needing to refresh my browser's proxy so it's probably not per request. Since the rest of the app doesn't use the view layer, this is probably not needed.
Thanks for your quick replies!
This change caches view templates in memory:
Alternatively, this can be enabled by setting
NODE_ENV=production
but I couldn't figure out how to generate a plist with the environment variable.