Skip to content

Package types is not being resolved in a TS setup when moduleResolution is bundler #2480

Closed
@raulfdm

Description

@raulfdm

Describe the bug

I've noticed that when using graphql-modules in a TypeScript project that defines moduleResolution: "bundler":

{
  "compilerOptions": {
    // ... other config
    "moduleResolution": "Bundler",
    "module": "ESNext",
    "noEmit": true,
  }
}

TypeScript cannot resolve the type definitions:

CleanShot 2023-12-10 at 09 13 41@2x

That's because in the generated dist/package.json, the types field is not present in the exports condition:

image

I won't write all the details here because I saw you're using a tool called bob to generate the final dist, and the problem is there.

I just opened this issue to keep it as a reminder so that when this problem is fixed on the bob's side, you can upgrade it and generate a release.

To Reproduce

  1. Clone this repository: https://github.com/devraul/graphql-modules-type-problem
  2. Follow the README instructions

Expected behavior

Working without a problem in TS configs where it defines the moduleResolution equals bundler

Environment:

  • OS: macOS
  • graphql-modules: 2.3.0
  • NodeJS: 20.10.0

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions