dexaai / dexter

LLM tools used in production at Dexa
https://dexter.dexa.ai
MIT License
69 stars 4 forks source link

Dexter sub-path imports don't seem to work without tsconfig "moduleResolution": "Bundler" #11

Closed transitive-bullshit closed 4 months ago

transitive-bullshit commented 10 months ago

Using "moduleResolution": "node" in the consuming project, which is very common, seems to break dexter's typing exports as tsserver can't find them.

Example:

import { type Prompt } from '@dexaai/dexter/prompt` // this gives an error

This will probably surprise anyone who tries to use this package, since before 2 weeks ago, I had never used "moduleResolution": "node".

It would be nice to use tsc only, but I wonder if we'd be better off using something like tsup for output compatibility?

transitive-bullshit commented 9 months ago

@rileytomasek what do you think of switching all example usage to import from @dexaai/dexter? We can keep the ESM exports to remain backwards compatible.

Reasoning:

rileytomasek commented 9 months ago

"moduleResolution": "node" is not the correct configuration for an ESM project — the correct values are bundler, node16, or nodenext. Sindre explains more here. Our time is better spend improving the library that providing compatibility with legacy CJS.

Adding root exports will likely just make this even harder to debug because then the import may work and it will fail deeper into the code.