drizzle-team / drizzle-team/drizzle-orm
Issues with ESBuild Register
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
There's an issue with `esbuild-register` that's impacting our ability to use drizzle-kit, the TL;DR; is esbuild-register doesn't seem to [resolve the project's tsconfig file correctly](https://github.com/egoist/esbuild-register/issues/38).
Did some instrumenting and observed that it fails to bubble up looking for a `tsconfig.json` for the project when running `drizzle-kit`:
```
Reading config file '/Users/jack/dev/marketplace/backend/libs/database/drizzle.config.ts'
loading /Users/jack/dev/marketplace/backend/libs/database/tsconfig.json
loading /Users/jack/dev/marketplace/backend/configs/tsconfig.json
loading /Users/jack/dev/marketplace/backend/configs/tsconfig.json
loading /Users/jack/dev/marketplace/backend/configs/tsconfig.json
loading /Users/jack/dev/marketplace/backend/configs/tsconfig.json
loading /Users/jack/dev/marketplace/backend/configs/tsconfig.json
loading /Users/jack/dev/marketplace/backend/configs/application/tsconfig.json
Error: Transform failed with 4 errors:
... ERROR: Transforming JavaScript decorators to the configured target environment ("es2021") is not supported yet
```
It seems like `esbuild-register` searches the local directory of the file under compilation for a `tsconfig.json`, and if not found, uses the default tsconfig settings. Our problem is that `backend` is a nest project that makes heavy use of decorators. `experimentalDecorators` is not a default tsconfig option and hence esbuild fails to compile the drizzle config file.
The original `esbuild-register` issue suggested this can be worked around by doing the tsconfig resolution yourself and passing that as an option to esbuild, bypassing its resolution of the `tsconfig.json`.
Contributor guide
Assessment
This issue has not been assessed yet.