Closed Pastromhaug closed 1 year ago
Hey @Pastromhaug, one challenge here is that options from next.config.js are used for the route generation. So, any nextjs-routes
command will need to parse next.config.js and then an API to provide nextjs-routes arguments will need to be considered. Does next build
work for your use case? That can be invoked in CI and will generate the routes file.
but we also have some nextjs config which appears to break when we use withRoutes() in next.config.js
What is breaking?
Ah ok, thanks for explaining, and for the quick response! I got withRoutes
working. Looks like it was I who messed up my next.confg.js
! Sorry for the false alarm there.
With that working I'll totally still add this package to our repo, so feel free to close this issue! However, for our use case it would definitely be preferable to be able to generate the types outside of the expo dev server for the other reasons i mentioned above!
Regardless, thanks!
@Pastromhaug does your build
command work for your CI use case? Eg next build
will generate types without starting the dev server.
I'm sure we could get next build
to work with a bit of effort! But I don't think we would choose to invest in that solution, as next build
takes a couple minutes to run.
@Pastromhaug This has been published in v2
I'd like to be able to manually generate the
nextjs-routes.d.ts
file instead of relying on the file watcher on the nextjs dev server. The main reason for this is so we can manually generate types in CI, but we also have some nextjs config which appears to break when we usewithRoutes()
innext.config.js
. Additionally, we have other codegen in our repo, so we'd like to be able to have one script that does all of it at once.What I'd like to do is to call the function
writeNextjsRoutes
manually in a script, but it's not exported so I can't use it. It would be even better if I could run a command likeyarn nextjs-routes codegen
to generate types, but I'll settle for the easiest possible soution.Thanks! Love this project. I'm excited to be able to use it.