TS Loader Decleration
Generates bundled Webpack Typescript declarations from exports.
Inspired by declaration-bundler-webpack-plugin.
Installation
You can grab the latest version via NPM.
npm install --save-dev ts-loader-decleration
Configuration
First ensure declaration: true
is set in your tsconfig.json
for declaration files to be generated.
Finally include the plugin in your Webpack configuration.
const path = const webpack = const JavaScriptObfuscator = const nodeExternals = const TSDeclerationsPlugin = moduleexports = entry: main: './src/index.ts' other: './src/other.ts' target: 'node' resolve: extensions: '.ts' '.js' externals: output: filename: './index.js' libraryTarget: "commonjs" plugins: main: './src/index.d.ts' disableConsoleOutput: false module: rules: test: /\.ts$/ loader: 'ts-loader' exclude: //
Only modules exported from your entry file will be included in the bundled declaration.
Awesome Typescript Loader
When using AWS there is an issue where imports will not be included in the declaration bundle unless it has been used literally. There is a loader included to patch this issue.
test: /\.ts$/ use: loader: 'awesome-typescript-loader' query: declaration: true //... loader: 'ts-loader-decleration'