Creating concatenated .d.ts with webpack

I would like to build a TypeScript project (in Visual Studio) with the following automatic steps:

  • compile each .ts file as an AMD module, separately
  • link each generated .js file to webpack, in release/my-app.js

As part of step 1, .d.ts files .d.ts also created for each .ts file (in addition to the Javascript output files). How can I combine these definition files together to provide type definitions for what is included in the output file my-app.js ?


project layout

 MyApp |-- lib | |-- foo.ts | |-- foo.js | |-- foo.d.ts | `-- ... |-- release | `-- my-app.js |-- main.ts |-- main.js |-- main.d.ts `-- webpack.config.js 

webpack.config.js

 module.exports = { context: __dirname, entry: './main.js', output: { path: path.join(__dirname, 'release'), filename: 'my-app.js' } } 
+5
source share
1 answer

You can try https://www.npmjs.com/package/dts-bundle , but this is experimental and it does not work with awesome-typescript -loader .

+2
source

Source: https://habr.com/ru/post/1246967/


All Articles