const path = require('path'); const TerserPlugin = require('terser-webpack-plugin'); module.exports = { mode: 'production', target: 'node', entry: './src/utils/stdio-transport.ts', output: { path: path.resolve(__dirname, 'dist'), filename: 'stdio-transport.js', library: { type: 'commonjs2' } }, module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/, }, ], }, resolve: { extensions: ['.tsx', '.ts', '.js'], extensionAlias: { '.js': ['.js', '.ts'], '.cjs': ['.cjs', '.cts'], '.mjs': ['.mjs', '.mts'] } }, optimization: { minimize: true, minimizer: [new TerserPlugin({ terserOptions: { format: { comments: false, }, }, extractComments: false, })], }, externals: { // Mark node modules as external to reduce bundle size 'express': 'commonjs express', 'winston': 'commonjs winston' } };