dts-webpack-bundler

1.0.3 • Public • Published

dts-webpack-bundler

This Webpack plugin generate a single TypeScript *.d.ts declaration file per entry (per chunk) using dts-bundle.

Currently supporting only webpack v3.x

Installation

$ npm install dts-webpack-bundler --save-dev

Usage

First you need to add the following to tsconfig.json:

NOTE: currently this plugin support only declaration files that are gathered into a single folder so, please make sure you're using "declarationDir" properly.

{
    "compilerOptions": {
        // ...
        "declaration": true,
        "declarationDir": "./typings/"
    }
}
Then in your webpack.config.js:
const DtsWebpackBundler = require('dts-webpack-bundler');
 
module.exports = {
    entry: './src/main.ts',
    output: {
        path: path.resolve('./dist'),
        filename: 'index.js'
    },
    plugins: [
        new DtsWebpackBundler({
            libName: 'library-name',
            typingsDir: path.resolve(process.cwd(), 'typings'),
            outputDir: path.resolve(process.cwd(), 'build'),
            deleteSource: true // deletes the typings folder after bundling it.
        })
    ]
}

Have Fun!

Package Sidebar

Install

npm i dts-webpack-bundler

Weekly Downloads

1

Version

1.0.3

License

MIT

Last publish

Collaborators

  • eliraz-refael