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

Make build output esm #28

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Make build output esm #28

merged 1 commit into from
Apr 26, 2024

Conversation

flakey5
Copy link
Collaborator

@flakey5 flakey5 commented Apr 25, 2024

This is to allow us to cleanup some of the logic for the AI providers (including most of the // @ts-expect-error comments) and allows us to mock imports (which we'll be using for llama2 support).

Unfortunately, with module and moduleResolution set to NodeNext in the tsconfig, we need to add .js extensions to relative imports. If we set module and moduleResolution to ESNext, this removes that requirement at build time. At runtime it will throw module not found errors because of the missing file extension. I haven't been able to find anything in the tsconfig that will add the file extensions for us either, and the next best solution would be to have some additional build step that goes into each file and adds the file extension. Regardless, it should be doable but I'm leaning towards this approach being better (although a bit ugly).

This is to allow us to cleanup some of the logic for the AI providers (including most of the `// @ts-expect-error` comments) and allows us to mock
imports (which we'll be using for llama2 support).
@flakey5 flakey5 marked this pull request as ready for review April 25, 2024 07:17
@flakey5 flakey5 requested a review from mcollina April 25, 2024 07:17
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit b7fb651 into main Apr 26, 2024
5 checks passed
@flakey5 flakey5 deleted the flakey5/use-esm branch April 26, 2024 19:50
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

Successfully merging this pull request may close these issues.

2 participants