webpack.config.js 781 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. const webpack = require("webpack");
  2. const path = require("path");
  3. const config = {
  4. entry: "./src/index.js",
  5. output: {
  6. publicPath: path.resolve(__dirname, ""),
  7. path: path.resolve(__dirname, "dist"),
  8. filename: "main.js",
  9. },
  10. plugins: [
  11. new webpack.ProvidePlugin({
  12. process: "process/browser.js",
  13. }),
  14. ],
  15. module: {
  16. rules: [
  17. {
  18. test: /\.js$/,
  19. use: "babel-loader",
  20. exclude: /node_modules/,
  21. },
  22. {
  23. test: /\.cjs$/,
  24. include: path.resolve(__dirname, "node_modules/@polkadot/"),
  25. use: "babel-loader",
  26. },
  27. {
  28. test: /\.js$/,
  29. include: path.resolve(__dirname, "node_modules/@polkadot/"),
  30. use: "babel-loader",
  31. },
  32. ],
  33. },
  34. };
  35. module.exports = config;