webpack.config.example.js 944 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const webpack = require("webpack");
  2. const path = require("path");
  3. module.exports = {
  4. mode: "development",
  5. devtool: "source-map",
  6. entry: {
  7. index: "./example/index",
  8. split: "./example/split",
  9. diff: "./example/diff"
  10. },
  11. output: {
  12. path: path.join(__dirname, "example/static"),
  13. filename: "[name].js",
  14. publicPath: "/static/"
  15. },
  16. resolve: {
  17. extensions: [".jsx", ".js", ".tsx", ".ts"]
  18. },
  19. plugins: [new webpack.HotModuleReplacementPlugin()],
  20. module: {
  21. rules: [
  22. {
  23. test: /(\.js|\.jsx)$/,
  24. use: {
  25. loader: "babel-loader"
  26. },
  27. exclude: /node_modules/
  28. },
  29. {
  30. test: /\.ts(x?)$/,
  31. use: ["babel-loader", "ts-loader"],
  32. exclude: /node_modules/
  33. }
  34. ]
  35. },
  36. devServer: {
  37. hot: true,
  38. contentBase: [
  39. path.join(__dirname, "example"),
  40. path.join(__dirname, "dist")
  41. ],
  42. compress: true,
  43. port: 9000
  44. }
  45. };