ts-declaration-webpack-plugin
This Webpack plugin generate a single TypeScript *.d.ts declaration file per entry.
Installation
$ npm install ts-declaration-webpack-plugin --save-dev
Usage
-
Simply add the plugin to
webpack.config.js
:const TsDeclarationWebpackPlugin = ;moduleexports =entry:app: './src/main.ts'component: './src/component.tsx'output:path: pathfilename: '[name].js'plugins: -
Done! will generate
app.d.ts
andcomponent.d.ts
next to thejs
files indist
folder!
Options
name: '[name].d.ts' // Not required, '[name].d.ts' by default (to match output fileName) test: /\.tsx$/ // Not required, filters '.ts' and '.tsx' by default