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

ESM build fails with import from '.' #3098

Open
egmacke opened this issue Mar 29, 2023 · 2 comments
Open

ESM build fails with import from '.' #3098

egmacke opened this issue Mar 29, 2023 · 2 comments

Comments

@egmacke
Copy link

egmacke commented Mar 29, 2023

The lib/esm/static.d.ts file in the (currently) latest version (1.0.0-rc.12) defines:

import type { CheerioAPI, Cheerio } from '.';

This causes ESM projects that use cheerio to fail to build as the import should be ... from './index.js

Error:

../../common/temp/node_modules/.pnpm/cheerio@1.0.0-rc.12/node_modules/cheerio/lib/esm/static.d.ts:2:42 - error TS2307: Cannot find module '.' or its corresponding type declarations.

2 import type { CheerioAPI, Cheerio } from '.';
                                           ~~~


Found 1 error in ../../common/temp/node_modules/.pnpm/cheerio@1.0.0-rc.12/node_modules/cheerio/lib/esm/static.d.ts:2
@nickmansrob
Copy link

This is linked with issue #2774. This is fixed in the source files but has not been released yet. I can confirm setting skipLibCheck to true in tsconfig.json resolves this issue for now.

@rauschma
Copy link

I just came across the same issue. Another work-around is to manually patch the file inside node_modules and change '.' to './index.js'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants