Whenever I deploy my next.js application each page is not reflecting the changes and sometimes when I refresh the page is getting crashed. It is working fine on local even on ‘npm run build’ and ‘npm start’ Any solution for this!
This is the content is showing
//next.config.mjs
const const nextConfig = {
async rewrites() {
return [
{
source: "/dashboard",
destination: "/pages/dashboard",
},
{
source: "/connectors",
destination: "/pages/connectors",
},
{
source: "/all-investigations",
destination: "/pages/all-investigations",
},
{
source: "/my-investigations",
destination: "/pages/all-investigations",
},
{
source: "/investigation-details",
destination: "/pages/investigation-details/[id]",
},
{
source: "/add-ai-coworker",
destination: "/pages/add-ai-coworker",
},
{
source: "/agent",
destination: "/pages/agent",
},
{
source: "/my-dashboard",
destination: "/pages/dashboard",
},
{
source: "/agent-details",
destination: "/pages/agent-details/[id]",
},
{
source: "/signup",
destination: "/auth/signup",
},
{
source: "/",
destination: "/auth/signin",
},
// Add more rewrite rules as necessary
];
},
// experimental: {
// optimizeCss: true,
// },
// transpilePackages: ["@acme/ui", "lodash-es"],
// compiler: {
// styledComponents: true,
// },
};
export default nextConfig;
//package.json
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest",
"test:watch": "jest --watch"
},
"dependencies": {
"@aws-amplify/adapter-nextjs": "^1.2.6",
"@microsoft/fetch-event-source": "^2.0.1",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/themes": "^3.0.3",
"@reduxjs/toolkit": "^2.2.3",
"aws-amplify": "^6.3.8",
"axios": "^1.6.8",
"chart.js": "^4.4.3",
"critters": "^0.0.24",
"install": "^0.13.0",
"js-cookie": "^3.0.5",
"latest": "^0.2.0",
"next": "^14.2.5",
"npm": "^10.8.0",
"radix-ui": "^1.0.1",
"react": "^18",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18",
"react-icons": "^5.0.1",
"react-json-tree": "^0.19.0",
"react-redux": "^9.1.1",
"react-syntax-highlighter": "^15.5.0",
"react-toastify": "^10.0.5",
"reactflow": "^11.11.1",
"redux-persist": "^6.0.0"
},
"devDependencies": {
"@babel/preset-env": "^7.24.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^15.0.2",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"@types/js-cookie": "^3.0.6",
"@types/node": "20.12.7",
"@types/react": "18.2.79",
"@types/react-dom": "^18",
"@types/react-syntax-highlighter": "^15.5.13",
"autoprefixer": "^10.0.1",
"babel-jest": "^29.7.0",
"eslint": "^8",
"eslint-config-next": "14.1.4",
"generate-react-cli": "^8.4.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"postcss": "^8",
"tailwindcss": "^3.3.0",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"typescript": "5.4.5"
}
}
I have tried adding different configuration from doc. Mainly I am using app routing in my application. I am deploying with amazon aws using ubuntu server with tmux.
Ananya Bandyopadhyay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.