dts-webpack-plugin

0.0.9 • Public • Published

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]

Package Sidebar

Install

npm i dts-webpack-plugin

Weekly Downloads

27

Version

0.0.9

License

MIT

Last publish

Collaborators

  • zyxd