Use esbuild as external dependency

I try to create a new obsidian plugin that create a vite dev server internally.
Vite has esbuild as a dependency. Obsidian warn me that esbuild should be external - so I added it to externals. But when I run the extension and try to create the dev server I get an error:

Plugin failure: obsidian-slidev Error: Cannot find module 'esbuild'
Require stack:
- electron/js2c/renderer_init
    at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at i._resolveFilename (node:electron/js2c/renderer_init:33:1095)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at c._load (node:electron/js2c/asar_bundle:5:13339)
    at i._load (node:electron/js2c/renderer_init:33:356)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Kt (app.js:1:262413)
    at o (app.js:1:1965682)
    at node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-a8e37fae.js (plugin:obsidian-slidev:111534:30)

How to fix this error?