viteesbuild

How to test the new esbuild version (v.0.21.0 with decorators) with Vite?


Could you help me to run Vite with the most recent esbuild v0.21.0 release?

I guess I must alter the vite.config.js, but I could not find anything in the docs.

I try to test the new decorators proposal with Vite.

https://github.com/evanw/esbuild/releases/tag/v0.21.0


Solution

  • You can just add an overrides section to your package.json, that enforces a newer esbuild version and run npm install afterwards. It should look similar to this:

    {
      // removed irrelevant stuff
    
      "devDependencies": {
        "vite": "^5.1.4"
      },
      "overrides": {
        "esbuild": "^0.21.0"
      }
    }
    

    It forces npm to use this version as a peer dependency instead of the version requested by vite.