ts-loader-declaration-export-plugin

This is a small webpack plugin to export only declaration files you choose. It's connected with ts-loader. So you install it first and then add "declaration": true in tsconfig.json.

Usage no npm install needed!

<script type="module">
  import tsLoaderDeclarationExportPlugin from 'https://cdn.skypack.dev/ts-loader-declaration-export-plugin';
</script>

README

ts-loader-declaration-export-plugin

What is this?

This is a small webpack plugin to export only declaration files you choose. It's connected with ts-loader. So you install it first and then add "declaration": true in tsconfig.json.

How do I use it?

Add plugin

yarn add -D ts-loader-declaration-export-plugin
npm install -D ts-loader-declaration-export-plugin

Add plugin to webpack

// webpack.config.js
const DeclarationExportPlugin = require('ts-loader-declaration-export-plugin');

module.exports = {
  ...
  plugins: [
    new DeclarationExportPlugin({
      modulePath: 'src/index.d.ts',
      output: 'index.d.ts',
    }),
  ],
  ...
}

Enjoy ;)