1.0.3 • Published 6 years ago
ts-specific-declarations-webpack-plugin v1.0.3
ts-specific-declarations-webpack-plugin
This Webpack plugin generates a single TypeScript *.d.ts declaration file per entry or per a list of a specified entry. The latter is a new feature which the forked repo does not offer.
Installation
$ npm install ts-specific-declarations-webpack-plugin --save-devUsage
Simply add the plugin to
webpack.config.js:const TsSpecificDeclarationWebpackPlugin = require('ts-specific-declarations-webpack-plugin'); module.exports = { entry: { app: './src/app.ts', component: './src/component.tsx', admin: './src/adminPanel/index.tsx', }, output: { path: path.resolve('./dist'), filename: '[name].js', }, plugins: [ // if no arguments are passed, default behavior is to create *.d.ts per entry. new TsSpecificDeclarationWebpackPlugin(), ] }Will generate
app.d.ts,component.d.tsandadmin.d.tsin the root directory
Arguments
[entries]- An optional array of objects which inludes the entries to generate the bundled *.d.ts for. If this argument is used, entries which are not in this list will be exlucded... plugins: [ new TsSpecificDeclarationWebpackPlugin( [ { name: 'app', }, { name: 'admin', dir: './admin/' } ] ), ]Will generare
./app.d.ts,./admin/admin.d.tsand will exclude thecomponententry since it was not specified