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

throw '"glob"' has no exported member named 'globSync'. Did you mean 'GlobSync' in 10.3.7 #555

Closed
kiner-tang opened this issue Sep 25, 2023 · 5 comments

Comments

@kiner-tang
Copy link

image

@kiner-tang kiner-tang changed the title '"glob"' has no exported member named 'globSync'. Did you mean 'GlobSync' throw '"glob"' has no exported member named 'globSync'. Did you mean 'GlobSync' in 10.3.7 Sep 25, 2023
@cpojer
Copy link

cpojer commented Sep 25, 2023

Can confirm, simply using 10.3.7 and using import { globSync } from 'glob'; causes this error. Downgrading to 10.3.6 resolves the issue.

Repro: https://codesandbox.io/p/sandbox/npm-playground-forked-ch2hmh?file=%2Findex.ts%3A3%2C7

@kiner-tang
Copy link
Author

Can confirm, simply using 10.3.7 and using import { globSync } from 'glob'; causes this error. Downgrading to 10.3.6 resolves the issue.

Repro: https://codesandbox.io/p/sandbox/npm-playground-forked-ch2hmh?file=%2Findex.ts%3A3%2C7

Yes, I lock the glob version to 10.3.6 to solve this issue now. Hope to solve this problem soon!

@colinrotherham
Copy link
Contributor

TypeScript won't enable resolvePackageJsonExports by default, but can help for now #556 (comment)

@isaacs
Copy link
Owner

isaacs commented Sep 25, 2023

I'll add the types field back in, but you really need to start doing "module": "node16" or "module": "nodeNext" in your tsconfigs, or you're almost certainly getting subtly wrong types any time you import a hybrid module, especially if you are building commonjs.

If you have that option enabled, but are still seeing these warnings, make sure that the module emitting the warning is covered by the tsconfig in question (ie, included in files or include, and not excluded by exclude options).

@isaacs
Copy link
Owner

isaacs commented Sep 25, 2023

Ah, actually, no, that leads to incorrect types being exported for the commonjs build, which is why tshy enforces that top level types remain unset.

Enable resolvePackageJsonExports, that is the correct way to address this.

This issue was closed.
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

4 participants