drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[FEATURE]: Upgrade esbuild in drizzle-kit to support es2023 target

Open bagbag opened this issue 1 year ago β€’ 16 comments

Running npx drizzle-kit generate errors with Invalid target "es2023" in "--target=es2023" in my project. Upgrading esbuild to the latest version solved that issue.

Describe what you want

Upgrading of esbuild to latest version.

bagbag avatar Oct 14 '24 15:10 bagbag

also - esbuild < 0.22 has security issues and the ~ symbol disallows us to upgrade it manually in our repo...

reference: https://github.com/evanw/esbuild/issues/3802

banuni avatar Oct 29 '24 13:10 banuni

We have the same issue, upgrading esbuild to 0.25.1 (latest as of writing) and drizzle-kit to 0.30.5 (latest as of writing) doesn't help. It only works when using target: ES2022

ahalimkara avatar Mar 11 '25 11:03 ahalimkara

Come on, guys. Upgrade it - the whole TS/JS world has moved on long time ago :-)

dm-8thblock avatar Mar 20 '25 12:03 dm-8thblock

We have the same issue, upgrading esbuild to 0.25.1 (latest as of writing) and drizzle-kit to 0.30.5 (latest as of writing) doesn't help. It only works when using target: ES2022

Thanks for sharing! I’m facing the same issue. You mentioned it only works when using target: ES2022 β€” how exactly did you set that target? I'm really struggling with this and can't seem to make it work...

Renato-dev13 avatar Mar 21 '25 07:03 Renato-dev13

Hi @Renato-dev13 , you just need to add target: ES2022 to tsconfig.json, example config:

{
    "compilerOptions": {
        "target": "ES2022",
        "module": "ES2022",
        "outDir": "dist",
        "moduleResolution": "Node",
        "skipLibCheck": true,
        "noUnusedLocals": true,
        "strict": true,
        "esModuleInterop": true,
        "resolveJsonModule": true
    },
    "include": ["src"]
}

ahalimkara avatar Mar 21 '25 10:03 ahalimkara

Hi, @ahalimkara. Thanks for the quick reply!

Renato-dev13 avatar Mar 21 '25 11:03 Renato-dev13

+1, just ran into the same issue.

lifeordev avatar Apr 02 '25 04:04 lifeordev

pLeASe FiX tHiS

ooau avatar Apr 02 '25 06:04 ooau

+1

afogel avatar Apr 02 '25 09:04 afogel

+1

andrewjmcgehee avatar Apr 04 '25 03:04 andrewjmcgehee

Same issue.

rbjakab avatar Apr 09 '25 17:04 rbjakab

+1

jmsofarelli avatar Apr 11 '25 11:04 jmsofarelli

+1

trezi29 avatar Apr 11 '25 17:04 trezi29

+1

GenericArt avatar Apr 14 '25 15:04 GenericArt

will be included in the next release

AndriiSherman avatar Apr 14 '25 16:04 AndriiSherman

@AndriiSherman Hey thanks a lot for the fix!

I can see that in 0.31.0 the direct dependency on esbuild was bumped via #4416, but we still transitively depend on older esbuild, which causes the issue mentioned above:

also - esbuild < 0.22 has security issues

Which we get dependabot alerts for. I sort of think this must be a separate issue, but since you've worked on this recently, you probably have the best context.

The dependency chain in question is [email protected] -> @esbuild-kit/[email protected] (deprecated) -> @esbuild-kit/[email protected] -> [email protected]

Also linking #4045 where people discuss the same issue and propose a possible fix

dinmukhamedm avatar Apr 18 '25 20:04 dinmukhamedm

@AndriiSherman Hey thanks a lot for the fix!

I can see that in 0.31.0 the direct dependency on esbuild was bumped via #4416, but we still transitively depend on older esbuild, which causes the issue mentioned above:

also - esbuild < 0.22 has security issues

Which we get dependabot alerts for. I sort of think this must be a separate issue, but since you've worked on this recently, you probably have the best context.

The dependency chain in question is [email protected] -> @esbuild-kit/[email protected] (deprecated) -> @esbuild-kit/[email protected] -> [email protected]

Also linking #4045 where people discuss the same issue and propose a possible fix

x2

oscar-ospina avatar Apr 29 '25 13:04 oscar-ospina

Dependabot cannot update esbuild to a non-vulnerable version The latest possible version that can be installed is 0.18.20 because of the following conflicting dependencies:

[email protected] requires esbuild@~0.18.20 via a transitive dependency on @esbuild-kit/[email protected] [email protected] requires esbuild@^0.25.2 No patched version available for esbuild The earliest fixed version is 0.25.0.

kyleremotehands avatar May 16 '25 23:05 kyleremotehands

+1

melonges avatar May 25 '25 20:05 melonges

+1 been seeing this for months now

 WARN  2 deprecated subdependencies found: @esbuild-kit/[email protected], @esbuild-kit/[email protected]

drizzle-kit 0.31.4
└─┬ @esbuild-kit/esm-loader 2.6.5
  └── @esbuild-kit/core-utils 3.3.2

joeshub avatar Jul 21 '25 18:07 joeshub

This should be closed in favor of #3067 -- esbuilt-kit/esm-loader needs to be replaced entirely with tsx

eli-front avatar Jul 29 '25 01:07 eli-front

In Your Project file tsconfig.json 1)

and Target { "compilerOptions": { "target": "es2023" } }

  1. if you adding remove -D just add it into npm install -D drizzle-kit❌

npm install drizzle-kit βœ…

to me this worked

Ahmad0Tanveer avatar Aug 27 '25 12:08 Ahmad0Tanveer

Hey everyone!

I've created this message to send in a batch to all opened issues we have, just because there are a lot of them and I want to update all of you with our current work, why issues are not responded to, and the amount of work that has been done by our team over ~8 months.

I saw a lot of issues with suggestions on how to fix something while we were not responding – so thanks everyone. Also, thanks to everyone patiently waiting for a response from us and continuing to use Drizzle!

We currently have 4 major branches with a lot of work done. Each branch was handled by different devs and teams to make sure we could make all the changes in parallel.


First branch is drizzle-kit rewrite

All of the work can be found on the alternation-engine branch. Here is a PR with the work done: https://github.com/drizzle-team/drizzle-orm/pull/4439

As you can see, it has 167k added lines of code and 67k removed, which means we've completely rewritten the drizzle-kit alternation engine, the way we handle diffs for each dialect, together with expanding our test suite from 600 tests to ~9k test units for all different types of actions you can do with kit. More importantly, we changed the migration folder structure and made commutative migrations, so you won't face complex conflicts on migrations when working in a team.

What's left here:

  • We are finishing handling defaults for Postgres, the last being geometry (yes, we fixed the srid issue here as well).
  • We are finishing commutative migrations for all dialects.
  • We are finishing up the command, so the migration flow will be as simple as drizzle-kit up for you.

Where it brings us:

  • We are getting drizzle-kit into a new good shape where we can call it [email protected]!

Timeline:

  • We need ~2 weeks to finish all of the above and send this branch to beta for testing.

Second big branch is a complex one with several HUGE updates

  • Bringing Relational Queries v2 finally live. We've done a lot of work here to actually make it faster than RQBv1 and much better from a DX point of view. But in implementing it, we had to make another big rewrite, so we completely rewrote the drizzle-orm type system, which made it much simpler and improved type performance by ~21.4x:
(types instantiations for 3300 lines production drizzle schema + 990 lines relations)

TS v5.8.3: 728.8k -> 34.1k
TS v5.9.2: 553.7k -> 25.4k

You can read more about it here.

What's left here:

Where it brings us:

  • We are getting drizzle-orm into a new good shape where we can call it [email protected]!

Breaking changes:

  • We will have them, but we will have open channels for everyone building on top of drizzle types, so we can guide you through all the changes.

Third branch is adding support for CockroachDB and MSSQL dialects

Support for them is already in the alternation-engine branch and will be available together with the drizzle-kit rewrite.

Summary

All of the work we are doing is crucial and should be done sooner rather than later. We've received a lot of feedback and worked really hard to find the best strategies and decisions for API, DX, architecture, etc., so we can confidently mark it as v1 and be sure we can improve it and remain flexible for all the features you are asking for, while becoming even better for everyone building on top of the drizzle API as well.

We didn't want to stay with some legacy decisions and solutions we had, and instead wanted to shape Drizzle in a way that will be best looking ahead to 2025–2026 trends (v1 will get proper effect support, etc.).

We believe that all of the effort we've put in will boost Drizzle and benefit everyone using it.

Thanks everyone, as we said, we are here to stay for a long time to build a great tool together!

Timelines

We are hoping to get v1 for drizzle in beta this fall and same timeline for latest. Right after that we can go through all of the issues and PRs and resond everyone. v1 for drizzle should close ~70% of all the bug tickets we have, so on beta release we will start marking them as closed!

AndriiSherman avatar Aug 30 '25 18:08 AndriiSherman