const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
  mode: 'production',
  target: "web",
  entry: path.resolve(__dirname, 'RPCaller.ts'),
  output: {
      path: path.resolve(__dirname, '../../lib'),
      filename: 'RPCaller.min.js',
      libraryTarget: 'commonjs',
  },
  resolve: {
    // Add `.ts` and `.tsx` as a resolvable extension.
    extensions: [".ts", ".tsx", ".js"]
  },
  module: {
    rules: [
      { test: /\.ts?$/, loader: "ts-loader" }
    ]
  },
  optimization: {
    minimizer: [
      new TerserPlugin({
        exclude: [
          /\.\/(.*)\/.ts/,
          /\.\/(.*).ts/,
        ],
      }),
    ],
  },
  externals: {
  }
}
