turbo icon indicating copy to clipboard operation
turbo copied to clipboard

[Turbopack] baseUrl in tsconfig is not respected

Open ramiel opened this issue 1 year ago • 1 comments

What version of Turbopack are you using?

alpha? (the one included in nextjs 13

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac

Describe the Bug

On build I receive these errors

error -
  [rendering]
    [root of the dev server]/...
      Error during SSR Rendering
      timed out waiting for the Node.js process to connect

  [resolve]
    src/components/Event/Rooms/StageEditor.tsx
      Error resolving esm request
      unable to resolve module "@generated/graphql"

    src/hooks/useSdk.ts
      Error resolving esm request
      unable to resolve module "@generated/graphql"

    src/pages/[organization]/event/[event]/rooms/[room].tsx
      Error resolving esm request
      unable to resolve module "@generated/graphql"

    [...]/node_modules/node-fetch/lib/index.mjs
      Error resolving commonjs request
      unable to resolve module "encoding"

  [typescript]
    [...]/node_modules/@react-editor-js/client/tsconfig.json
      An issue occurred while parsing a tsconfig.json file.
      extends doesn't resolve correctly

    [...]/node_modules/@react-editor-js/server/tsconfig.json
      An issue occurred while parsing a tsconfig.json file.
      extends doesn't resolve correctly

    [...]/node_modules/react-editor-js/tsconfig.json
      An issue occurred while parsing a tsconfig.json file.
      extends doesn't resolve correctly

This unable to resolve module "@generated/graphql" is weird, because baseUrl in tsconfig takes care of this and it's working normally.
The typescript errors refer to dependencies where the tsconfig should not be considered

Expected Behavior

It should work :)

To Reproduce

Cannot provide a reproduction at the moment, I'll try later today

Reproduction Repo

No response

ramiel avatar Oct 26 '22 07:10 ramiel

because baseUrl in tsconfig takes care of this and it's working normally.

This is strange, we have support for baseUrl in https://github.com/vercel/turbo/blob/eeeba9540fd1e43a9c384ff8a94fd291ebfc8523/crates/turbopack-ecmascript/src/typescript/resolve.rs#L108-L114

The typescript errors refer to dependencies where the tsconfig should not be considered

Opened https://github.com/vercel/turbo/issues/2380.

jridgewell avatar Oct 26 '22 16:10 jridgewell