const path = require('path'); const webpack = require('webpack'); const BomPlugin = require('webpack-utf8-bom'); const NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); module.exports = { mode: 'production', target: "web", entry: path.resolve(__dirname, 'src', 'main.ts'), output: { path: path.resolve(__dirname, 'lib', 'browser'), filename: "rjsvm.browser.js", libraryTarget: 'window' }, resolve: { extensions: [".ts", ".tsx", ".js"], fallback: { buffer: require.resolve('buffer/'), } }, module: { rules: [ { test: /\.ts?$/, loader: "ts-loader" } ] }, optimization: { minimize: true, }, plugins: [ new NodePolyfillPlugin(), new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'], }), new webpack.ProvidePlugin({ process: 'process/browser.js', }), new BomPlugin(true) ], externals: { } }