-
Notifications
You must be signed in to change notification settings - Fork 61
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
'baml-cli generate' supports ES Module #1213
Comments
oh that's a great request. We should really just support raw Meanwhile, I think your workaround would be:
|
I think i did it but it does not work out. So, i have the following struture:
(2) Main Project (NestJs) -> import
Or did you mean that at (2) I should import the whole Package P1? |
yes at (2) you should import the whole package. Basically you can just build a standalone package with your baml client and then add it to the package dependencies in package #2. You can use something like npm or pnpm workspaces. The problem is just hot-reloading, and the development cycle is going to be longer. Perhaps we can add a flag to the generator block to add |
I confirm it worked. |
ESM is especially important for Deno. At the moment, you must What would raw (FYI workaround for now, ensure
is in your |
One other complicating consideration here: Deno enforces the correct file extension, so in the case of a typescript file it expects:
Whereas in node, you would use
Even for typescript files. (Because when using node.js everything is ultimately transpiled to js, whereas that is not the case in Deno) One alternative, instead of making
|
Currently,
baml-cli generate
creates .ts files such asglobals.ts
containg the following import:Compilation in
module
type can cause error, as the resolve without file extensions.js
cannot executed.How can I force
baml-cli generate
to create the import with file extensions i.e.import { getBamlFiles } from './inlinedbaml.js'
?The text was updated successfully, but these errors were encountered: