inertia-laravel
inertia-laravel copied to clipboard
Pass through NODE_ENV to Node-based Inertia SSR server
Got an error like the one below, so I have realized that process.env.NODE_ENV === 'production' checks always detect that the environment is not production on the SSR node server, sometimes leading to debug mode behaviour and skipping of production optimizations.
This PR solves the issue by passing through Laravel's environment to the Node-based Inertia SSR server when starting the server through the inertia:start-ssr command.
Error mentioned:
SerializableStateInvariantMiddleware took 35ms, which is more than the warning threshold of 32ms. If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions. It is disabled in production builds, so you don't need to worry about that.
Seeing as NODE_ENV would usually either be development or production: would it make sense to pass production if the app()->environment is production, or pass development otherwise? That avoids it being set to 'local' for example which wouldn't be a useful value in most cases, but is common in Laravel.
Heya. We removed our master branch. Feel free to re-attempt this to 1.x!