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

Using moduleResolution: bundler fails to resolve typings #49

Closed
JoostK opened this issue Apr 2, 2024 · 2 comments · Fixed by #50
Closed

Using moduleResolution: bundler fails to resolve typings #49

JoostK opened this issue Apr 2, 2024 · 2 comments · Fixed by #50

Comments

@JoostK
Copy link

JoostK commented Apr 2, 2024

When TypeScript's bundler module resolution mode is used (or the stricter node16/nodenext variants), would an error be reported:

error TS7016: Could not find a declaration file for module 'diff-match-patch-ts'. 'node_modules/diff-match-patch-ts/diff-match-patch-ts.mjs' implicitly h
as an 'any' type.
  There are types at 'node_modules/diff-match-patch-ts/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'diff-match-patch-ts' library may need to update its package.json or typings.

This is because the exports map refers the types condition for import to a non-existent index.d.mts file. I believe the types entry should refer to the same index.d.ts file as is used for CJS bundles, which should be compatible. When I apply this change manually my build succeeds.

Note: I am using 0.5.0, the latest version at time of writing.

@rars
Copy link
Owner

rars commented Apr 17, 2024

Thanks @JoostK for reporting this. I made the suggested change in v0.5.1. Please let me know if you still have any problems.

@JoostK
Copy link
Author

JoostK commented Apr 17, 2024

Thank you for addressing it! Unfortunately I've since had to abandon the effort to adopt bundler resolution due to some other compatibility issues (IIRC Jest with CJS modules didn't particularly like it), but given that 0.5.1 contains the exact change I patched in at the time this should work.

Thanks again and for maintaining this package in the first place! 🙏

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