const path = require('path'); const webpack = require('webpack'); const BomPlugin = require('webpack-utf8-bom'); 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: { "zlib": require.resolve("browserify-zlib"), "http": require.resolve("stream-http"), "https": require.resolve("https-browserify"), "stream": require.resolve("stream-browserify") , "buffer": require.resolve('buffer/'), "Buffer": require.resolve('buffer/'), "url": require.resolve('url/'), "crypto": require.resolve('crypto-browserify'), } }, module: { rules: [ { test: /\.ts?$/, loader: "ts-loader" } ] }, optimization: { minimize: true, }, plugins: [ new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'], }), new webpack.ProvidePlugin({ process: 'process/browser.js', }), new BomPlugin(true) ], externals: { } }