webpack.config.js 743 B

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