webpack.common.js 750 B

1234567891011121314151617181920212223242526272829303132
  1. const HtmlWebPackPlugin = require("html-webpack-plugin");
  2. const path = require('path');
  3. const htmlPlugin = new HtmlWebPackPlugin({
  4. title: "Production",
  5. template: "src/index.html"
  6. });
  7. module.exports = {
  8. entry: {
  9. app: './src/index.js',
  10. },
  11. module: {
  12. rules: [
  13. {
  14. test: /\.js$/,
  15. exclude: /node_modules/,
  16. use: {
  17. loader: "babel-loader"
  18. }
  19. }, {
  20. test: /\.css$/,
  21. use: ["style-loader", "css-loader"]
  22. }
  23. ]
  24. },
  25. plugins: [htmlPlugin],
  26. output: {
  27. filename: '[name].bundle.js',
  28. path: path.resolve(__dirname, 'dist'),
  29. clean: true
  30. }
  31. };