Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

webpack.gateway.js 1.5KB

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