Custom middleware does not work with esbuild because emitDecoratorMetadata is not supported
See original GitHub issuehttps://github.com/lukeautry/tsoa/issues/961
According to this ticket, tsoa
doesn’t rely on the emitDecoratorMetadata
TS option. That seemed correct at the time of writing, but sadly appears to no longer be true: https://github.com/lukeautry/tsoa/blob/acdfeb4d398fa7416dd10e251029d9e109c216d3/packages/runtime/src/decorators/middlewares.ts#L41
Because esbuild
doesn’t support emitDecoratorMetadata
, it appears that custom middleware via the @Middlewares
annotation cannot be used with esbuild.
Is there any advice for a workaround?
Sorting
-
I’m submitting a …
- bug report
- feature request
- support request
-
I confirm that I
- used the search to make sure that a similar issue hasn’t already been submit
Expected Behavior
Current Behavior
Possible Solution
Steps to Reproduce
Context (Environment)
Version of the library: Version of NodeJS:
- Confirm you were using yarn not npm: [ ]
Detailed Description
Breaking change?
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
"emitDecoratorMetadata": false, supported or not? #961 - GitHub
I am attempting to evaluate tsoa for suitability in my stack. We use esbuild to produce a bundle. esbuild DOES support the tsconfig...
Read more >Content Types - ESBuild
The emitDecoratorMetadata TypeScript configuration option is not supported. This feature passes a JavaScript representation of the corresponding TypeScript type ...
Read more >Getting started with NestJS, Vite, and esbuild - LogRocket Blog
In this article, we'll learn about NestJS, Vite, and esbuild; how they work together; and how to configure a NestJS app to make...
Read more >vite-plugin-node - npm
A vite plugin to allow you to use vite as node dev server. Features. All the perks from Vite plus: Node server HMR!...
Read more >Next Generation Node.js server Development Tool - Axe
Life is short, don't waste on the server reloading. ... I'm recently working on a relatively large nestjs backend project.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We fixed it. It turns out the issue is
import {Middlewares} from 'tsoa'
. It works if we doimport {Middlewares} from '@tsoa/runtime'
. This is surprising but it works. I guess I was barking up the totally wrong tree. Sorry about that and thanks for looking!@jsamilow thanks for the suggestion! Build fails if I’m importing from
tsoa
but it works just fine with@tsoa/runtime