A sample project that demonstrates the "ChunkLoadError" when using the app router in a dockerized Next.js SPA with Nginx.
To run the project in a development environment:
cd
into the root directory of the project- Run the following command (replace with your chosen container name):
docker-compose -p <container-name> up --build
To run the project in a production environment:
cd
into the root directory of the project- Run the following command (replace with your chosen container name):
docker-compose -p <container-name> --file docker-compose.production.yaml up --build
The app router bug can only be observed in a production container.
Steps to Reproduce:
- Run the the project in a production environment
- Click on the "Go to Dynamic Route" button. You will be presented with an application error
- Right-click anywhere on the webpage and click "Inspect". The browser console will display the "ChunkLoadError"