webpack.config.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. const path = require("path");
  2. const webpack = require("webpack");
  3. const config = {
  4. entry: {
  5. index: './src/index.ts',
  6. bridge: './src/bridge.ts',
  7. },
  8. output: {
  9. publicPath: path.resolve(__dirname, ""),
  10. path: path.resolve(__dirname, "dist"),
  11. filename: "[name].js",
  12. },
  13. resolve: {
  14. extensions: [".ts", ".js", ".mjs", ".cjs", ".json"],
  15. fallback: { crypto: require.resolve("crypto-browserify"), stream: require.resolve("stream-browserify"), "assert": require.resolve("assert"), buffer: require.resolve('buffer'), },
  16. },
  17. plugins: [
  18. new webpack.ProvidePlugin({
  19. process: "process/browser.js",
  20. Buffer: ['buffer', 'Buffer'],
  21. }),
  22. ],
  23. module: {
  24. rules: [
  25. {
  26. test: /\.ts$/,
  27. use: "babel-loader",
  28. exclude: /node_modules/,
  29. },
  30. {
  31. test: /\.mjs$/,
  32. include: /node_modules/,
  33. type: "javascript/auto",
  34. },
  35. {
  36. test: /\.cjs$/,
  37. include: path.resolve(__dirname, "node_modules/@polkadot/"),
  38. use: "babel-loader",
  39. },
  40. {
  41. test: /\.js$/,
  42. include: path.resolve(__dirname, "node_modules/@polkadot/"),
  43. use: "babel-loader",
  44. },
  45. {
  46. test: /\.js$/,
  47. include: path.resolve(__dirname, "node_modules/@acala-network/"),
  48. use: "babel-loader",
  49. },
  50. {
  51. test: /\.js$/,
  52. include: path.resolve(__dirname, "node_modules/@nuts-finance/"),
  53. use: "babel-loader",
  54. },
  55. {
  56. test: /\.js$/,
  57. include: path.resolve(__dirname, "node_modules/@polkawallet/"),
  58. use: "babel-loader",
  59. },
  60. ],
  61. },
  62. };
  63. module.exports = config;