next.js icon indicating copy to clipboard operation
next.js copied to clipboard

The automatically generated `tsconfig.json` file is missing `moduleResolution`

Open liby opened this issue 2 years ago • 4 comments

Verify canary release

  • [X] I verified that the issue exists in Next.js canary release

Provide environment information

$ next info

    Operating System:
      Platform: darwin
      Arch: x64
      Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
    Binaries:
      Node: 16.15.0
      npm: 8.5.5
      Yarn: 1.22.17
      pnpm: 7.0.0
    Relevant packages:
      next: 12.1.7-canary.23
      react: 18.1.0
      react-dom: 18.1.0

What browser are you using? (if relevant)

N/A

How are you deploying your application? (if relevant)

N/A

Describe the Bug

Follow the instructions to install TypeScript, try starting the development server again.

View the generated tsconfig.json file:

Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy.ts image

Expected Behavior

The generated tsconfig.json file should contain the moduleResolution key.

To Reproduce

# If you’re using npm
npm install --save-dev typescript @types/react @types/node

# If you’re using Yarn
yarn add --dev typescript @types/react @types/node

npm/yarn run dev

View the tsconfig.json file

liby avatar May 30 '22 08:05 liby

I've reached with the same issue when setup my project manually. Then I removed the result and try to use Automatic Setup. This solved my problem!

nosovandrew avatar Jul 18 '22 10:07 nosovandrew

I have that issue as well.

I also added tsconfig.json manually and have Next generate the config.

Adding moduleResolution works!

ubervincent avatar Jul 30 '22 11:07 ubervincent

Adding "moduleResolution": "node" to tsconfig.json was worked.

nwleedev avatar Aug 02 '22 01:08 nwleedev

If I create a next app and then add Typescript to it after. I get the error. But if I run npx create-next-app --typescript I don't get the error. Why is this?

image

image

hkbertoson avatar Aug 05 '22 19:08 hkbertoson

I added moduleResolution manually and it works

OksanaShtanhei avatar Aug 11 '22 18:08 OksanaShtanhei

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

github-actions[bot] avatar Oct 07 '22 00:10 github-actions[bot]