webpack.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. const path = require('path')
  2. const HtmlWebPackPlugin = require("html-webpack-plugin");
  3. module.exports = {
  4. entry: ['./src/app/index.js'],
  5. output: {
  6. path: path.join(__dirname, 'dist/app'),
  7. filename: 'index.js',
  8. publicPath: '/',
  9. },
  10. module: {
  11. rules: [
  12. {
  13. test: /\.(js|jsx)$/,
  14. exclude: /node_modules/,
  15. use: {
  16. loader: "babel-loader",
  17. options: {
  18. presets: [
  19. "@babel/preset-env",
  20. "@babel/preset-react"
  21. ]
  22. }
  23. }
  24. },
  25. {
  26. test: /\.html$/,
  27. use: [
  28. {
  29. loader: "html-loader"
  30. }
  31. ]
  32. },
  33. {
  34. test: /\.css$/,
  35. use: [
  36. 'style-loader',
  37. 'css-loader'
  38. ],
  39. },
  40. ]
  41. },
  42. plugins: [
  43. new HtmlWebPackPlugin({
  44. template: "src/index.html"
  45. })
  46. ]
  47. };