Closed Krakof closed 4 years ago
@Krakof
Ok, I'll add ssr.config.js#webpackMode
👍
I hope this will help for you :)
@saltyshiomix Sorry for annoying you. It would be great to run whole ssr in specific mode not only webpack.
if (process.env.NODE_ENV === 'production') {
await (await import('./optimize/production')).default(app);
} else {
await (await import('./optimize/development')).default(app);
}
may be we can pass node_env as second parameter to register function? Thanks
@Krakof Ok, I got it! I'll try it soon :)
@Krakof
You want to run the app with process.env.NODE_ENV === 'k8s'
and want to choice react-ssr's ENV (development or production), right?
@Krakof
Another choice,
Do you like process.env.REACT_SSR_ENV
?
@Krakof
I added process.env.REACT_SSR_ENV
for now.
Could you try @react-ssr/nestjs-express@^0.21.15
?
package.json
{
"scripts": {
"start": "cross-env NODE_ENV=k8s REACT_SSR_ENV=production node dist/main.js"
}
}
Everything works, thanks a lot.
Hi, For some reason I have NODE_ENV="k8s" for kubernetes, so in this case ssr part builds in dev mode when the whole app works in production. To fix this I have to customize npm script with:
start: "NODE_ENV=production ts-node ....."
But what if I need my origin NODE_ENV and can't change it. Could you please add some customization to be able to control build mode(e.g second parameter at register function):register.ts
webpack.config.js and may be in other files
Thanks in advance