webpack.config.prod.js 644 B

12345678910111213141516171819202122232425
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const CopyWebpackPlugin = require('copy-webpack-plugin');
  4. const { CleanWebpackPlugin } = require('clean-webpack-plugin');
  5. module.exports = {
  6. mode: 'production',
  7. output: {
  8. filename: 'static/bundle.[hash].js',
  9. path: path.resolve('dist'),
  10. },
  11. plugins: [
  12. new CleanWebpackPlugin({
  13. cleanAfterEveryBuildPatterns: ['dist']
  14. }),
  15. new webpack.HotModuleReplacementPlugin(),
  16. new CopyWebpackPlugin(
  17. [
  18. {
  19. from: path.resolve(__dirname, '../static'),
  20. to: path.resolve(__dirname, '../dist/static')
  21. }
  22. ]),
  23. ],
  24. };