tdw

typescript-declaration-webpack-plugin

Bundels typescript declaration generated by typescript in webpack.

Showing:

Popularity

Downloads/wk

661

GitHub Stars

18

Maintenance

Last Commit

6mos ago

Contributors

2

Package

Dependencies

0

Size (min+gzip)

1.1KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

typescript-declaration-webpack-plugin

Bundles typescript declarations generated by typescript loaded into one .d.ts file.

What it does

The Plugin looks at all declaration files which the typescript loader generated and merges them into one. Import will be sorted so that each module or package is only imported once.

Setup

Install via npm

Install this plugin via npm.

npm install --dev typescript-declaration-webpack-plugin

tsconfig.json

Enable declaration generation by adding the following to the compiler options in your tsconfig.json file.

{
  "compilerOptions": {
    "declaration": true
  }
}

Webpack plugin

Add the following to your webpack.config.js file.

const TypescriptDeclarationPlugin = require('typescript-declaration-webpack-plugin');
//...
module.exports = {
  //...
  plugins: [
    new TypescriptDeclarationPlugin({
      // Options for TypescriptDeclarationPlugin (see below)
    });
  ]
  //..
};
//...

Options

There are several options how you can customize the behavior of this plugin. Just pass these options to the constructor of the TypescriptDeclarationPlugin class.

OptionDescrptionType
outName of the bundled file. Per default index.d.tsstring
removeMergedDeclarationsIf true the plugin will remove all merged declaration files. Per default truebool
removeCommentsRemove all comments from declaration files. Per default truebool

Feature plan

  • Merging declaration map's generated by declarationMap compiler option
  • Support multiple entry points, only include declarations of imported sources
  • Multiline comments should remove only the comment part

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100