Migration experiences from Page router to app router (Nextjs12->13)
Unanswered
Siricid woodwasp posted this in #help-forum
Siricid woodwaspOP
Seeking for suggestions, return of experiences π
14 Replies
Little yellow ant
I've been working on the app router migration for a while. There is a lot of really great stuff but so much of it is extremely flaky or developed in a way that goes against common best practices (I'm looking at the way app router deals with environment variables and config at runtime). I'd recommend staying on pages router
@Little yellow ant I've been working on the app router migration for a while. There is a lot of really great stuff but so much of it is extremely flaky or developed in a way that goes against common best practices (I'm looking at the way app router deals with environment variables and config at runtime). I'd recommend staying on pages router
I'm looking at the way app router deals with environment variables and config at runtimeit's fully supported via
.env files. Runtime variables are also fully supported@Siricid woodwasp solved?
@Little yellow ant I've been working on the app router migration for a while. There is a lot of really great stuff but so much of it is extremely flaky or developed in a way that goes against common best practices (I'm looking at the way app router deals with environment variables and config at runtime). I'd recommend staying on pages router
Siricid woodwaspOP
oh really, because I wanted to use those new features.. streaming ssr etc did you have a go at it ?
@B33fb0n3 <@863019919657533471> solved?
Siricid woodwaspOP
it was more of an open discussion as I wanted to hear from people who managed to migrate successfully and understand what challenges they had to get there
Little yellow ant
I would recommend using Suspense in combination with react's lazy instead of using
next/dynamic for streaming ssrI've had a lot of success with the migration but I have also had a ton of headaches. One thing I recommend avoiding is parallel routes, I ran into issues that didn't have decent workarounds. Sometimes keeping things simple and a little more old school is just the better choice.
Little yellow ant
Are you hosting with vercel?
@B33fb0n3 > I'm looking at the way app router deals with environment variables and config at runtime
it's fully supported via .env files. Runtime variables are also fully supported
Little yellow ant
I'm speaking to Vercel wanting you to build the app in the environment it is running on. I would love to be shown a better way to handle that though. I ended up home brewing my own solution
@Little yellow ant Are you hosting with vercel?
Siricid woodwaspOP
I'm not
@Little yellow ant I've had a lot of success with the migration but I have also had a ton of headaches. One thing I recommend avoiding is parallel routes, I ran into issues that didn't have decent workarounds. Sometimes keeping things simple and a little more old school is just the better choice.
Siricid woodwaspOP
did you notice better score for TTFB by doing so ?
Little yellow ant
IMO suspense,
next/dynamic and parallel routes will all give you better TTFB. My main issue with next/dynamic is that it was putting stack traces in the html it sent to the client. The documentation says it isn't supposed to in prod builds but it still did for me. Throw in that it was challenging to get ssr html to be viewable in the client with javascript off (aka scrapers) with it.@Little yellow ant IMO suspense, `next/dynamic` and parallel routes will all give you better TTFB. My main issue with `next/dynamic` is that it was putting stack traces in the html it sent to the client. The documentation says it isn't supposed to in prod builds but it still did for me. Throw in that it was challenging to get ssr html to be viewable in the client with javascript off (aka scrapers) with it.
Siricid woodwaspOP
oh I see, I didn't know about the stack traces in the html sent to the client, I'll check if I got it too