I have an NextJS app that I build on a build server then deploy to another server to host it.
When I start the app in development mode npm wants to recompile the app even though all of the built components still exist. (.next folder, etc...)
When I run the app in a non development mode for next the app will start up with no build attempts.
Why does npm want to rebuild the app when const app = next({ true });
?
In server/server.js
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
In package.json
"scripts": {
"dev": "NODE_ENV=development npm start",
"staging": "NODE_ENV=staging npm start",
"prod": "NODE_ENV=production npm start",
"build": "next build",
"start": "node server/server.js"
}
How I'm starting the app:
Development: npm run dev
Production: npm run prod