const path = require('path'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const mode = process.env.NODE_ENV || 'production'; module.exports = { target: 'webworker', entry: path.join(__dirname, 'index.ts'), output: { filename: `worker.${mode}.js`, path: path.join(__dirname, 'dist'), }, mode, resolve: { extensions: ['.ts', '.tsx', '.js'], plugins: [ new TsconfigPathsPlugin({ configFile: path.resolve(__dirname, './tsconfig.json'), }), ], }, module: { rules: [ { test: /\.tsx?$/, loader: 'ts-loader', options: { transpileOnly: true, configFile: path.join(__dirname, 'tsconfig.json'), }, }, ], }, };