Skip to content
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

Help Me #201

Open
ageha734 opened this issue Jul 3, 2023 · 6 comments
Open

Help Me #201

ageha734 opened this issue Jul 3, 2023 · 6 comments

Comments

@ageha734
Copy link

ageha734 commented Jul 3, 2023

Error1

tsconfig:

{
  "extends": "@tsconfig/next/tsconfig.json",
  "compilerOptions": {
    "paths": {
      "lib/*": [
        "lib/*"
      ]
    }
  }
}

TypeScript 5 have the following error:
TypeError: Cannot read properties of undefined (reading 'push') at writeConfigurationDefaults (/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js:227:30) at async verifyTypeScriptSetup (/node_modules/next/dist/lib/verifyTypeScriptSetup.js:120:9) at async DevServer.verifyTypeScript (/node_modules/next/dist/server/dev/next-dev-server.js:648:34) at async DevServer.prepareImpl (/node_modules/next/dist/server/dev/next-dev-server.js:672:9) at async NextServer.prepare /node_modules/next/dist/server/next.js:165:13) at async Server.<anonymous> (/next/dist/server/lib/render-server.js:123:17) { type: 'TypeError' }

Error2

tsconfig:

{
  "extends": "node_modules/@tsconfig/next/tsconfig.json",
  "compilerOptions": {
    "paths": {
      "lib/*": [
        "lib/*"
      ]
    }
  }
}

TypeScript 5 have the following error:
error TS6053: File 'node_modules/@tsconfig/next/tsconfig.json' not found.

Development environment

  • os: macOS13.4.1
  • node: 18.16.0
  • pnpm 8.5.1
  • next: 13.4.5
  • preact: 10.15.1
  • react: 18.2.0
  • react-dom: 18.2.0
  • @tsconfig/next: 2.0.0

List of commands executed

  • pnpm dev
  • pnpm remove @tsconfig/next
  • pnpm add -D @tsconfig/next
  • pnpm dev

summary

I can't build with an error even after changing the path to the Extended Settings file and re-installing.

@orta
Copy link
Member

orta commented Jul 3, 2023

Did you install the packages?

@ageha734
Copy link
Author

ageha734 commented Jul 3, 2023

Yes. Installed and used.

@orta
Copy link
Member

orta commented Jul 3, 2023

I'm unsure, maybe next does something strange to the paths but that seems unlikely

@ageha734
Copy link
Author

ageha734 commented Jul 3, 2023

I think the proper setting is

"extends":"@tsconfig/next/tsconfig.json"

but is there any other place to set it?

@orta
Copy link
Member

orta commented Jul 5, 2023

Nope that goes in your tsconfig

@emkman
Copy link

emkman commented Aug 23, 2023

@ageha734 the issue is with Next.js. It expects an include key in your tsconfig.json. Instead of

{
  "extends": "@tsconfig/next/tsconfig.json"
}

you need something like this

{
  "extends": "@tsconfig/next/tsconfig.json",
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

Generally, it seems like this package doesn't play that well with Next.js expectations which does a lot of checks and automatic injection into your tsconfig.json and so it's probably better to just copy and paste from https://github.com/tsconfig/bases/blob/main/bases/next.json manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants