選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

webpack.gateway.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  4. if(!process.env['DATA_HASH']){
  5. console.log("Environment DATA_HASH not set")
  6. process.exit(1)
  7. }else{
  8. console.log(`Webpacking Gateway with DATA_HASH=${process.env['DATA_HASH']}`)
  9. }
  10. module.exports = {
  11. mode: 'production',
  12. target: "web",
  13. entry: path.resolve(__dirname, 'src', 'Gateway.ts'),
  14. output: {
  15. path: path.resolve(__dirname, 'build', 'gateway'),
  16. filename: '[name].js'
  17. },
  18. plugins: [
  19. new webpack.ProvidePlugin({
  20. process: 'process/browser',
  21. }),
  22. //new BundleAnalyzerPlugin(),
  23. //new webpack.IgnorePlugin(/.*ripple-lib.*/),
  24. new webpack.DefinePlugin({
  25. DATA_HASH: JSON.stringify(process.env['DATA_HASH'])
  26. })
  27. ],
  28. resolve: {
  29. // Add `.ts` and `.tsx` as a resolvable extension.
  30. extensions: [".ts", ".tsx", ".js"],
  31. fallback: {
  32. "fs": false,
  33. "tls": false,
  34. "net": false,
  35. "path": false,
  36. "zlib": false,
  37. "http": false,
  38. "https": false,
  39. "stream": false,
  40. "crypto": false,
  41. "Buffer": require.resolve('buffer'),
  42. "crypto-browserify": require.resolve('crypto-browserify'),
  43. }
  44. },
  45. externals: {
  46. 'lodash': ['_'],
  47. 'xrpl': ['xrpl'],
  48. 'ripple-lib': ['ripple'],
  49. 'RippleAPI': ['ripple-lib', 'RippleAPI'],
  50. 'bn.js': ['BN'],
  51. 'Buffer': ['buffer'],
  52. 'buffer': ['buffer'],
  53. 'zlib': ['browserifyZlib']
  54. },
  55. module: {
  56. rules: [
  57. { test: /\.ts?$/, loader: "ts-loader", }
  58. ]
  59. },
  60. }