webpack.prod.js 635 B

1234567891011121314151617181920212223242526
  1. const path = require('path')
  2. const HtmlWebpackPlugin = require('html-webpack-plugin')
  3. module.exports = {
  4. mode: 'production', // ['development', 'production']
  5. entry: path.join(__dirname, 'src', 'index.js'),
  6. output: {
  7. filename: 'bundle.[contenthash].js',
  8. path: path.join(__dirname, 'dist')
  9. },
  10. module: {
  11. rules: [
  12. {
  13. test: /\.js$/,
  14. loader: ['babel-loader'],
  15. include: path.join(__dirname, 'src'),
  16. exclude: /node_modules/
  17. }
  18. ]
  19. },
  20. plugins: [
  21. new HtmlWebpackPlugin({
  22. template: path.join(__dirname, 'src', 'index.html'),
  23. filename: 'index.html'
  24. })
  25. ]
  26. }