Closed ecstrema closed 1 year ago
@ecstrema the nextjs-routes.d.ts is generated into types/nextjs-routes.d.ts.
you can not gitignore this file because typechecking occurs before the build step runs in nextjs.
Hmm that's interesting... The best way might be to run the generating cli before build then...
So for those wanting a fix: here's what I did:
package.json:
{
"scripts": {
"build": "nextjs-routes && next build",
}
}
That way, you can add /@types/nextjs-routes.d.ts
to .gitignore
Yep, alternatively you could disable typechecking in your next.config.js and then run tsc —noEmit after you build.
It seems that only next dev generates the file, but next build does not, so if I .gitignore the generated typings, build fails on CI.
I read in the readme that the route typings are generated during build also, but cannot reproduce this.
to reproduce
next build
Since typings are not created, the typescript build fails if we
expected
The file is also generated during build