dts-webpack-plugin
v0.0.9
Published
That plugin for Webpack generate single TypeScript declaration file
Downloads
2,301
Maintainers
Readme
dts-webpack-plugin
That Webpack plugin generate single TypeScript *.d.ts declaration file using dts-bundle.
Installation
$ npm install dts-webpack-plugin --save-dev
Usage
First you need to add the following to tsconfig.json:
{
"compilerOptions": {
// ...
"declaration": true,
"declarationDir": "./"
}
}
Then in your webpack.config.js:
const DtsPlugin = require('dts-webpack-plugin');
module.exports = {
entry: './src/main.ts',
output: {
path: path.resolve('./dist'),
filename: 'index.js'
},
plugins: [
new DtsPlugin({
name: 'project-name'
})
]
}
Result
Asset Size Chunks Chunk Names
index.js 566 bytes 0 [emitted] main
index.d.ts 333 bytes [emitted]