-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
next dev
rewrites tsconfig.json
#8128
Comments
Also #8034 |
If you don't want We can look into retaining comments. |
It's indeed the same issue as #8034, sorry for not noticing it earlier. It's OK for Next.js to generate new It's also debatable whether Next.js "needs" some of the things it says so, for example, I don't think What I'm trying to say: in the end, tsconfig should be user's responsibility. It's fine if Next.js makes reasonable suggestions or does some changes automatically in some cases, but it should be careful and conservative, IMO. |
@borekb Whether or not Without this option, TypeScript features that are not supported by Babel will break in unexpected / indeterminate ways and cause countless hours of debugging. I agree that the config overwrite should never be "destructive", and we'll work on fixing this. |
I just don't think that Next.js should be writing into my source files, especially as a by-product of something as innocent-looking as
Maybe there are some other options as well. I understand the good intent though and appreciate your effort around this! |
I've scheduled this for work in 9.0.7, here's what we'll do:
|
That's great, thank you 🙏🏼 Can we please also support its (and next-env.dts') location in a configurable place? |
|
@Timer I'm a little unclear of your plan from this comment: #8128 (comment) If I've specified |
Version 9.1.6 still override everything... |
So feel free to send a PR, the issue has “good first issue” and “help wanted” labels. Here’s what you can implement: |
Yep, 9.1.6 still override. |
@stvmachine I'm not sure what you're trying to achieve with this comment. You contribute this feature as it's marked as |
This pull request updates our TypeScript verification process to not wipe out potentially vital user comments. Introducing a prompt process was mostly a side effect of users wanting to keep comments. There's no reason we really need this prompt, as answering no would refuse to boot the Next.js server anyway. --- Fixes #8128 Closes #11440
This pull request updates our TypeScript verification process to not wipe out potentially vital user comments. Introducing a prompt process was mostly a side effect of users wanting to keep comments. There's no reason we really need this prompt, as answering no would refuse to boot the Next.js server anyway. --- Fixes vercel#8128 Closes vercel#11440
Hey there, For better or worse, I am a user of ambient const enums. We have a "legacy codebase" and the effort to refactor away from using them has been judged as far too much - we just have too much code that relies on their existence. We have written a Babel plugin to allow Babel to compile code that uses these enums. This is working well with our Storybook project, which is another project that relies on Babel for TypeScript transpilation - from this we know that Babel works just fine with The remaining hurdle for deploying our new NextJS project is that This issue appears to have been closed automatically as NextJS no longer removes comments, but as of 9.5.3 the isolatedModules option is still mandatory. Would the team accept a PR that allowed |
This is quite hacky and awful, feel free to improve, but here's post-install script that may be useful for anyone else who really isn't a fan of their config files being overwritten: https://gist.github.com/rschristian/7051745e06e235381924291f9285d938 |
For anyone else struggling with this - I applied @rschristian's solution using patch-package. This makes it automatically re-apply without any extra plumbing, in a super consistent way. Steps:
Voila, every time you add/remove/update your npm packages, the patch will automatically be re-applied. And |
Bug report
Describe the bug
When I run
next dev
and some of the "required" Next.js options are missing (even non-critical ones likeforceConsistentCasingInFileNames
), mytsconfig.json
is completely rewritten – my comments are deleted and the file is re-formatted.To Reproduce
next dev
tsconfig.json
, removeforceConsistentCasingInFileNames
and add some comment.next dev
againExpected behavior
My
tsconfig.json
is mytsconfig.json
😄.System information
Additional context
This is from the "TypeScript support is too eager in v9" bucket, IMO. Some more issues I'd regard in that category are e.g. #7687 or #8065 (though they are about different things).
The text was updated successfully, but these errors were encountered: