ts-declaration-webpack-plugin

1.2.3 • Public • Published

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 = require('ts-declaration-webpack-plugin');
     
    module.exports = {
        entry: {
            app: './src/main.ts',
            component: './src/component.tsx',
        },
        output: {
            path: path.resolve('./dist'),
            filename: '[name].js',
        },
        plugins: [
            new TsDeclarationWebpackPlugin(),
        ]
    }
  • Done! will generate app.d.ts and component.d.ts next to the js files in dist folder!

Options

new TsDeclarationWebpackPlugin({
    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
})

Have Fun!

Dependencies (2)

Dev Dependencies (3)

Package Sidebar

Install

npm i ts-declaration-webpack-plugin

Weekly Downloads

28

Version

1.2.3

License

MIT

Unpacked Size

6.45 kB

Total Files

8

Last publish

Collaborators

  • unimonkiez