webpack.config.js 650 B

123456789101112131415161718192021222324252627282930313233
  1. import path from "node:path";
  2. import { fileURLToPath } from "node:url";
  3. const __filename = fileURLToPath(import.meta.url);
  4. const __dirname = path.dirname(__filename);
  5. const config = {
  6. mode: "development",
  7. entry: "./src/index.ts",
  8. module: {
  9. rules: [
  10. {
  11. test: /\.tsx?$/,
  12. use: "ts-loader",
  13. exclude: /node_modules/,
  14. },
  15. ],
  16. },
  17. resolve: {
  18. extensions: [".tsx", ".ts", ".js"],
  19. },
  20. output: {
  21. filename: "bundle.js",
  22. path: path.resolve(__dirname, "dist"),
  23. },
  24. devServer: {
  25. static: {
  26. directory: path.join(__dirname, "dist"),
  27. },
  28. compress: true
  29. }
  30. };
  31. export default config;