LGiki / wails-template-nextjs

A wails template with Next.js
MIT License
49 stars 4 forks source link

nextjs with app router is not working #4

Open learncodingforweb opened 1 year ago

learncodingforweb commented 1 year ago

If i replace nextjs frontend folder with newly create app

✔ What is your project named? … frontend
✔ Would you like to use TypeScript with this project? … No / Yes
✔ Would you like to use ESLint with this project? … No / Yes
✔ Would you like to use Tailwind CSS with this project? … No / Yes
✔ Would you like to use `src/` directory with this project? … No / Yes
✔ Use App Router (recommended)? … No / Yes
✔ Would you like to customize the default import alias? … No / Yes
✔ What import alias would you like configured? … @/*
Creating a new Next.js app in /home/camera/dev/concept/frontend.

next_app_static_site

On navigate to About page url, getting unable to finish request: StatusCodes not supported: 404 - Not Found

But if app create without App router then, it it working fine.

Can you resolve issue with nextjs app using App Router?

LGiki commented 1 year ago

Thank you for reporting, but I am unable to reproduce your issue. I will update this project to the latest NextJS and use the app router. I am quite busy moving house at the moment so will get to it as soon as possible.

learncodingforweb commented 1 year ago

I am providing complete example code https://github.com/learncodingforweb/wails_next_app_router . Note it is working in development mode. But when app is build, after that running app and on navigate to about page, getting error StatusCodes not supported: 404 - Not Found. Please update solution so that app can be run in production mode.

LGiki commented 1 year ago

What operating system are you using? I tested it on both Linux and Windows, and everything was fine on Windows, but I ran into the same issue on Linux. I suspect it's an upstream problem. Wails uses libwebkit as the web container on Linux, and it often encounters some strange issues. I'll continue to investigate this problem. Screenshot from 2023-06-29 15-22-31

Screenshot from 2023-06-29 15-24-23

LGiki commented 1 year ago

I found that on Linux, when clicking the link to jump to the about page, the request was /a instead of /about, so it returned a 404 Not Found, and I do not know why this happened, recommend temporarily using pages router for now.

learncodingforweb commented 1 year ago

I am running on ubuntu22.04 LTS