jasonkuhrt / graphql-request

Minimal GraphQL client
MIT License
5.77k stars 307 forks source link

Document the requirement of tooling support for package.exports #845

Closed jasonkuhrt closed 2 months ago

jasonkuhrt commented 2 months ago

Perceived Problem

Lots of issues like this thinking there is a bug:

Ideas / Proposed Solution(s)

Related

Also please vote here :) https://github.com/jasonkuhrt/graphql-request/discussions/863

jakeleventhal commented 2 months ago

I disagree with your stance on this. Many people rely on this library and you introduced a breaking, non-backwards compatible change.

Here is my TS config. There is nothing wrong or outdated about it. This library should not be breaking

{
  "compilerOptions": {
    "allowJs": false,
    "declaration": false,
    "esModuleInterop": true,
    "incremental": true,
    "inlineSources": true,
    "isolatedModules": true,
    "lib": ["ESNext"],
    "module": "Node16",
    "moduleResolution": "Node16",
    "noEmitOnError": true,
    "outDir": "./dist",
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "sourceRoot": "/",
    "strict": true,
    "target": "ES6"
  },
  "exclude": ["dist", "node_modules"]
}
jasonkuhrt commented 2 months ago

@jakeleventhal Your moduleResolution looks correct. If you want to share a repro repo I'll take a look at some point. You can make a new issue for that. Your comment is off topic from this issue which is about documentation mentioning the necessary TS setup.

jakeleventhal commented 2 months ago

@jasonkuhrt https://github.com/jakeleventhal/graphql-request-type-issue

jasonkuhrt commented 2 months ago

Thanks @jakeleventhal! I'll try to take a look this week.

jonkoops commented 2 months ago

@jasonkuhrt it might be worth it to integrate publint and @arethetypeswrong/cli to automate the quality checks on CI.

jasonkuhrt commented 2 months ago

Nice I'll take a look!

jasonkuhrt commented 2 months ago

@jakeleventhal The issue is your config, its literally in the message you put in your README.

> src/index.ts:1:31 - error TS2307: Cannot find module 'graphql-request' or its corresponding type declarations.
  There are types at '/Users/jakeleventhal/Code/graphql-request-type-issue/packages/test/integrations/node_modules/graphql-request/build/entrypoints/main.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

1 import { GraphQLClient } from "graphql-request";

CleanShot 2024-05-15 at 22 59 59@2x

jasonkuhrt commented 2 months ago

I'm locking this issue as it has been resolved.