-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
TypeScript module "NodeNext" does not resolve index.d.ts
from CJS modules
#47848
Comments
Huh, I didn't realize we were relying on the directory lookup behavior to fallback to find the main |
Hm, it's a little bit more complicated than that - looks like |
I've opened both #47854 with a fix for this to match node's current behavior, and nodejs/node#41940 to get some kind of discussion about node surprising esm resolver behavior when importing packages via relative paths. |
Hi, don't know if I should open new issue, so decided to report here
I'd like to open issues in corresponding libraries, to fix it properly Upd. fixed in preact master and it's now clear for me what to do |
Bug Report
π Search Terms
NodeNext, esm, CJS, cli-spinners
π Version & Regression Information
nodenext
is only supported in the nightly versions.β― Playground Link
From what I can tell you can't install npm modules in the playground, so I made a repro on StackBlitz: https://stackblitz.com/edit/node-opvt9e?file=index.ts run
npm run typecheck
in the console to see the issue.π» Code
π Actual behavior
TypeScript cannot find the typings for
cli-spinners
which is a CJS module. It does not use amain
orexports
ortypes
field in thepackage.json
, it just includes aindex.js
andindex.d.ts
file.π Expected behavior
New
NodeNext
module behaviour to import CJS as it used to. E.g looking atindex.d.ts
if there is nomain
field. https://www.typescriptlang.org/docs/handbook/module-resolution.html#how-typescript-resolves-modulesπͺ Related
main
fieldΒ sindresorhus/cli-spinners#61The text was updated successfully, but these errors were encountered: