1.0.3 • Published 6 years ago

dts-webpack-bundler v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

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!

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago