const path = require('path'); const webpack = require('webpack'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; if(!process.env['DATA_HASH']){ console.log("Environment DATA_HASH not set") process.exit(1) }else{ console.log(`Webpacking Gateway with DATA_HASH=${process.env['DATA_HASH']}`) } module.exports = { mode: 'production', target: "web", entry: path.resolve(__dirname, 'src', 'Gateway.ts'), output: { path: path.resolve(__dirname, 'build', 'gateway'), filename: '[name].js' }, plugins: [ new webpack.ProvidePlugin({ process: 'process/browser', }), //new BundleAnalyzerPlugin(), //new webpack.IgnorePlugin(/.*ripple-lib.*/), new webpack.DefinePlugin({ DATA_HASH: JSON.stringify(process.env['DATA_HASH']) }) ], resolve: { // Add `.ts` and `.tsx` as a resolvable extension. extensions: [".ts", ".tsx", ".js"], fallback: { "fs": false, "tls": false, "net": false, "path": false, "zlib": false, "http": false, "https": false, "stream": false, "crypto": false, "Buffer": require.resolve('buffer'), "crypto-browserify": require.resolve('crypto-browserify'), } }, externals: { 'lodash': ['_'], 'xrpl': ['xrpl'], 'ripple-lib': ['ripple'], 'RippleAPI': ['ripple-lib', 'RippleAPI'], 'bn.js': ['BN'], 'Buffer': ['buffer'], 'buffer': ['buffer'], 'zlib': ['browserifyZlib'] }, module: { rules: [ { test: /\.ts?$/, loader: "ts-loader", } ] }, }