How can I stop Next.js from messing with my tsconfig? #58022
Replies: 8 comments 2 replies
-
I'm also running into this issue with version: 13.5.6 |
Beta Was this translation helpful? Give feedback.
-
I didn't have the issue with the |
Beta Was this translation helpful? Give feedback.
-
This is genuinely terrible behavior if you don't want to allow certain settings just give a warning.
Why overwrite whatever I try to add with that? I've never seen a dev tool be that overly aggressive about screwing up my configs. |
Beta Was this translation helpful? Give feedback.
-
I stumbled into this when I was importing some uncompiled React components from another library. I tried using the The flow of a build process should be unidirectional. A build tool that modifies source (and |
Beta Was this translation helpful? Give feedback.
-
I am using
{
"extends": "@repo/typescript-config/nextjs.json",
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
},
},
"include": [
"next-env.d.ts",
"next.config.js",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"plugins": [{ "name": "next" }],
"module": "ESNext",
"moduleResolution": "Bundler",
"allowJs": true,
"jsx": "preserve",
"noEmit": true
}
}
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"declaration": false,
"declarationMap": false,
"esModuleInterop": true,
"incremental": true,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
"module": "NodeNext",
"moduleDetection": "force",
"moduleResolution": "NodeNext",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022",
"forceConsistentCasingInFileNames": true
}
} Starting the dev server immediately overwrites my tsconfig even though it should be strict already.
|
Beta Was this translation helpful? Give feedback.
-
i have the same issue. why the heck is next messing with my tsconfig? due to legacy reasons, i don't want strictNullChecks to be set to true. this basically breaks my app. |
Beta Was this translation helpful? Give feedback.
-
I also struggled with this issue, and I don't think the vercel team will take the advice to leave tsconfig unchanged. So I wrote a little script dedicated to patch next.js, just simply run Source code: https://www.npmjs.com/package/stop-nextjs-from-messing-tsconfig |
Beta Was this translation helpful? Give feedback.
-
The pursuit of optimal DX is a double edged sword - this ones hurts more than it helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Whenever I start next dev server, it overwrites my tsconfig with its opinionated settings:
How can I stop Next.js from doing that?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions