webpack.config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const HtmlWebpackPlugin = require('html-webpack-plugin');
  2. const path = require('path');
  3. module.exports = {
  4. entry: './src/index.js',
  5. plugins: [new HtmlWebpackPlugin(
  6. {
  7. template: 'home.html'
  8. }
  9. )],
  10. output: {
  11. filename: '[name].bundle.js',
  12. path: path.resolve(__dirname, 'dist'),
  13. },
  14. module: {
  15. rules: [
  16. {
  17. test: /\.css$/,
  18. use: ['style-loader', 'css-loader'],
  19. },
  20. {
  21. test: /path\.txt/,
  22. use: ['file-loader'],
  23. },
  24. {
  25. test: /\.(js|jsx)$/,
  26. exclude: /node_modules/,
  27. use: {
  28. loader: 'babel-loader'
  29. }
  30. },
  31. {
  32. test: /\.(png|jp(e*)g|svg|gif)$/,
  33. use: [
  34. {
  35. loader: 'file-loader',
  36. options: {
  37. name: 'images/[hash]-[name].[ext]',
  38. },
  39. },
  40. ],
  41. },
  42. ],
  43. },
  44. resolve: {
  45. extensions: [".js", ".jsx"]
  46. },
  47. mode: 'production',
  48. performance: {
  49. hints: false,
  50. maxEntrypointSize: 512000,
  51. maxAssetSize: 512000
  52. },
  53. devServer:{
  54. compress: false,
  55. port: 9002,
  56. static: './dist',
  57. client:{overlay: false}
  58. },
  59. };