webpack.config.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const path = require('path');
  2. const HtmlWebpackPlugin = require('html-webpack-plugin');
  3. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  4. const CopyPlugin = require('copy-webpack-plugin');
  5. module.exports = {
  6. entry: ['./src/index.js'],
  7. mode: "production",
  8. target: "web",
  9. module: {
  10. rules: [
  11. {
  12. test: /\.s[ac]ss$/i,
  13. use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
  14. },
  15. {
  16. test: /\.css$/i,
  17. use: [MiniCssExtractPlugin.loader, "css-loader"],
  18. }
  19. ],
  20. },
  21. plugins: [new HtmlWebpackPlugin({
  22. template: path.resolve("src", "index.html"),
  23. templateParameters: {
  24. 'favicon': '/assets/logo.png',
  25. 'manifest': '/assets/manifest.json'
  26. },
  27. }), new MiniCssExtractPlugin(),new CopyPlugin({
  28. patterns: [
  29. { from: "src/assets", to: "assets" }
  30. ],
  31. })],
  32. output: {
  33. path: path.resolve(__dirname, 'build'),
  34. filename: '[name].d3v4pp.bundle.js',
  35. publicPath: "/"
  36. },
  37. devServer: {
  38. client: {
  39. progress: true,
  40. reconnect: true,
  41. overlay: {
  42. errors: true,
  43. warnings: false,
  44. },
  45. },
  46. historyApiFallback: true,
  47. open: true,
  48. static: {
  49. directory: path.join(__dirname, 'src'),
  50. },
  51. compress: true,
  52. port: 9000
  53. }
  54. };