How to direct TypeScript/WebPack to output all, individual d.ts files to single flat directory?

1k Views Asked by At

I'm using WebPack and TypeScript to create a component library. Everything is working and building as expected, except TypeScript (ts-loader or tic) outputs the .d.ts files in the same folder hierarchy as the source. While I could just write a cleanup script to move them into a flat build folder with their .js counterparts, I would prefer if they were output there to start with.

declarationDir only changes the relative base path, but doesn't give any kind of structure to how I want the files to be laid out. Is there a way in TypeScript, ts.config, and/or WebPack to output them all to the same flat folder as the .js files? I plan to implement dts bundle for the bundled library file, but I still want individual dts files for the individual component outputs (similar to the material-components-web project).

0

There are 0 best solutions below