-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Quickstart not working with esm #114
Comments
Need to experiment more with different tools and write more docs about ESM. If nothing works, try to use ES modules in node.js are the way of pain, so if it continues to be as broken, consider using commonjs. |
Thanks for letting me know. |
I use vite-node with esm modules and it works just fine. Moreover, I reuse the same vite config for the production build (a single ESM bundle), which is very convenient. The problem with tsx is that it struggles with tsconfig path aliases in monorepo: privatenumber/tsx#96 |
@akutruff what is |
I added instructions to configure a project with vite-node. I tried |
can you guide me to the correct instructions link, the old link is broken i am trying to setup the db with common package in mono repo, so i can share the types and validation easily between different modules, but zod types and db res are giving me unknown and [x: string]: any; |
@KMJ-007 for vite-node with ESM, simply follow the quickstart and choose vite-node. But this issue is about ESM, not related to monorepos. I don't know how to share types and validations, it highly depends on your monorepo setup and isn't easy to configure properly. I use pnpm workspaces, defining paths to packages in tsconfig like here, and also defining paths to packages for jest in jest config. If you export types and validations that depend on the ORM from package A and want to import them to package B, package B also should have the same version of the ORM in its dependencies. |
@KMJ-007 See the minimal monorepo where package
...or not have it in dependencies at all. For those cases when |
Edit: found out that I could get it to create the database with
tsx
but the error was that I hadn't setup myDATABASE_URL
to have a database name after the/
However,ts-node
still does not work.I'm trying to setup my project, using the quickstart with the demo tables and no other modifications.
I've tried several derivations of the configuration and none seem to be working, but I'm assuming it's a configuration issue.
I'm listing all below:
Project root
tsconfig.json
The above is imported for the package with the quickstart code
packages/orchiddb/tsconfig.json
package.json
Note:
with-env
does not matter. It's just a way to load the environment file, and I verified that the problems are the same with or without usingwith-env
.I put in 3 versions - without esm, with esm, and then also tried to use
tsx
which actually executed the code but failed later on. See below for errors.tsx
actually is able to execute the script but fails for postgres reasons but gives no helpful output.Attempts
(No ESM)
pnpm db create
(ESM)
pnpm db:esm create
(TSX)
pnpm db:tsx create
Update: this actually works now. I didn't see that I needed to have a dbname after the forward slash. However, there is no clear error being output, so there's still an issue here.
The text was updated successfully, but these errors were encountered: