esbuild + typescript double IIFE

30 views Asked by At

I am using esbuild to compile and minify typescript script files that will be served to browsers. I have a single source directory that holds all my source files, that will then be compiled and served on different websites. I write these source files as IIFEs so that my compiler will not complain about redeclaring block-scoped variable names (as it does not know, that these files will never be served together, but rather one per website).

Now when I run esbuild, it will wrap everything in another iife. That is not necessarily a huge performance issue, but redundant.

Is there a better way to approach this, that will result in a single IIFE, without having tsc complain?

Thanks for you help!

0

There are 0 answers