Production Build in Next.js: UI Changes Not Reflecting and Data Fetching Fails on One Page #135638
Unanswered
alirezarastineh
asked this question in
npm
Replies: 1 comment
-
First thought I had was caching but you said you removed the .next folder. So it can't be that. Try disabling swcMinify is your next config and let us know if that fixes it. My thinking here is that maybe something is getting messed up during bundling. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I'm working on a Next.js project with TypeScript, using Redux Toolkit for state management and API calls. The application works perfectly in development mode (
npm run dev
), but I'm encountering serious issues after building the project for production (npm run build
) and running it (npm run start
).Issues:
After making changes to my UI components and styles, these updates are visible in development mode, but they don't appear when I run the application in production mode. The UI remains as it was before the changes.
/customer/handbook
and/admin/all-handbooks
) that fetches data using Redux Toolkit Query fails to load the data in production mode, displaying a generic error message:Error: An unexpected error occurred
. However, this page works fine in development mode and was working in production before this issue suddenly appeared.The error is generated from a utility function that processes API errors:
These issues arose without any changes to the settings or configurations. The only thing I did was the usual development work, and then I wanted to test the application in production mode.
Steps I’ve Taken:
node_modules
, deleted the.next
folder, cleared the npm cache, and reinstalled everything. I then rebuilt the project withnpm run build
. Unfortunately, the issues persisted.NEXT_DEBUG=true npm run
build to get detailed logs. The build completes successfully with some ESLint warnings, but nothing that seems to explain the issues.next.config.mjs
to ensure there’s nothing specific causing issues in the production build.What I Expected:
Beta Was this translation helpful? Give feedback.
All reactions