-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TSConfig auto-generated generated in the wrong location #7782
Comments
Hey @tills13! This is the expected behavior because Next.js might require specific TypeScript settings that do not agree with the rest of your application. If you feel strongly about relocating the { "extends": "../../tsconfig.json" } |
That solution works for me - thanks! |
@Timer That's an ugly workaround (imho), I only keep actual application code in |
@wouterds this feature is typically only used for monorepos (yes, |
While I'm ok with the above solution, it seems like |
For reference if we could go back in time |
Yeah, came by to say the same thing. Having a special tsconfig.json that just extends the real one because the autogenerated file is not put at the root of the project, as it should be, is... not great. I also don't think it's yet been mentioned that @Timer monorepos are growing ever more popular. but even if they weren't, consistency of app layout between repositories is important. it's not unusual for repos to have put their source in '/src', types in some other place, and keep configuration elsewhere. babelrc, eslint, nodemon configs etc all live at project roots. tsconfig.json is supposed to too. Please let us specify through something in next.config.js, the locations of both tsconfig.json and next-env.d.ts. The magic autogeneration is a reasonable fallback for those who don't care. |
Not to mention that even if we use the workaround, the builder still automatically adds more fields to the config, including Combined with the issue of failed imports from named exports (#7882), I can't move to Next 9, which is a real shame. |
I only notice now, but this has been fixed 9.0.7. I can finally use the src folder out of the box! #8451 |
I actually think this is a good feature, I have a project which the root represents the server code
I was worry about Next.js will pick up the Deployment is so easy for this, otherwise you need to move around the client building bundle to the folder that server code used to serve. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
When using TypeScript and a custom project directory,
tsconfig.json
is auto-generated in the wrong location. This file should be located in the root of your project.To Reproduce
src/ts/pages
and addindex.tsx
next build src/ts
(note the custom project directory)NextJS will see that you are building a TypeScript project and that you do not have a
tsconfig.json
and will generate one for you. Note that this file is generated insrc/ts
instead of where you rannext
from (the project root).Expected behavior
tsconfig.json
is generated in the project root.System information
The text was updated successfully, but these errors were encountered: