dnt
dnt copied to clipboard
Allow generating a single UMD bundle with all code
I started porting a project to dnt and so far that has gone well. I bumped into a little problem, though.
It seems the UMD code the tool emits is split to follow the original module structure. In my case, that's adding extra roundtrips I would like to avoid. Instead, the target is to match the old build which emitted a single file with all the code.
I have the related PR here if you want to have a look, https://github.com/survivejs/sidewind/pull/57 .
Previously I was using tsdx in my setup and I imagine it's doing exactly that or using something like a rollup to handle bundling as it's possible TS itself might not be able to handle the task.
FWIW, I think tsdx is managing this case through rollup as it's bundling the built version into a single file.
My understanding is that it's not possible to achieve that with TypeScript alone as it wasn't designed with the use case in mind but please correct me if I'm wrong.
Having bundled UMD support would be a big deal for packages that target the web in particular as that avoids waterfalls of requests that would be visible in the current solution where each module receives a separate built UMD file of its own.