Published types in @deephaven npm packages are not NodeNext
compatible
#2273
Labels
bug
Something isn't working
Milestone
When deploying @deephaven npm packages, we build the packages by running
npm run build
. This:ESM modules require imports to include the file extension. The Babel compilation seems to produce proper ESM compatible imports by adding the extensions to imports, while the types build does not. This is because TypeScript will not automatically add file extensions, it leaves it up to the author to add the extensions. This causes trouble if a consumer configured for
NodeNext
attempts to import types.As an example, when configuring a project as
"module": "NodeNext"
this fails to find the type:This works:
Options I'm aware of that would fix this are:
export type *
(not sure why this actually works and doesn't really seem a proper fix).js
extension. This would be a large refactor to fix the entire codebase. Could be worth targetting specific modules. Also could be worth automating in 1 pass at some point as this seems to be the "proper" format to use. Update imports to use explicit file extensions #223Lastly, it seems like some scenarios work as-is, so "not ESM compatible" may be a bit too strong of a statement, but it seems we should investigate what the "proper" format should be here for broader compatibility.
The text was updated successfully, but these errors were encountered: