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

CJS type definitions reference ESM files causing type-checking to fail #620

Open
1 task
enisdenjo opened this issue Jan 16, 2025 · 1 comment
Open
1 task
Labels
bug Something isn't working

Comments

@enisdenjo
Copy link
Owner

enisdenjo commented Jan 16, 2025

Causing errors like:

node_modules/graphql-ws/dist/use/ws.d.cts:4:61 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../common-X.js")' call instead.

4 import { b as ConnectionInitMessage, a as Disposable } from '../common-X.js';
                                                              ~~~~~~~~~~~~~~~~

node_modules/graphql-ws/dist/use/ws.d.cts:5:36 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../server-CK311QSe.js")' call instead.

5 import { S as ServerOptions } from '../server-X.js';
                                     ~~~~~~~~~~~~~~~~

Is actually an issue caused by pkgroll.

Can be fixed by skipping lib checks during type-checking.

Enable skipLibCheck in tsconfig.json:

{
  "compilerOptions": {
    "skipLibCheck": true
  }
}

TODO

  • Open an issue over at pkgroll
@enisdenjo enisdenjo added the bug Something isn't working label Jan 16, 2025
@acrogenesis
Copy link

Thanks, adding skipLibCheck fixed the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants