webpack.config.renderer.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. const HtmlWebpackPlugin = require('html-webpack-plugin');
  2. const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
  3. const CopyPlugin = require('copy-webpack-plugin');
  4. let config = {
  5. devtool: 'source-map',
  6. mode: 'production',
  7. target: "electron-renderer",
  8. // entry: {
  9. // index: "./src/renderer/index.js",
  10. // serial: "./src/renderer/handler.js",
  11. // about: "./src/renderer/about.js",
  12. // esptools: "./src/renderer/esptools.js",
  13. // update: "./src/renderer/update.js"
  14. // },
  15. // output: {
  16. // path: __dirname + "/dist/renderer/",
  17. // filename: "[name].js"
  18. // },
  19. // optimization: {
  20. // minimize: false,
  21. // // minimizer: [
  22. // // new UglifyJSPlugin({
  23. // // parallel: true,
  24. // // sourceMap: true
  25. // // })
  26. // // ],
  27. // splitChunks: {
  28. // chunks: 'all',
  29. // minSize: 30000,
  30. // minChunks: 1,
  31. // maxAsyncRequests: 5,
  32. // maxInitialRequests: 3,
  33. // name: 'lib.min'
  34. // },
  35. // runtimeChunk: {
  36. // name: 'lib.min'
  37. // }
  38. // },
  39. plugins: [
  40. // new HtmlWebpackPlugin({
  41. // filename: "index.html",
  42. // template: "./src/renderer/assets/template.ejs",
  43. // chunks: ['lib.min', 'index']
  44. // }),
  45. // new HtmlWebpackPlugin({
  46. // filename: "serialport.html",
  47. // template: "./src/renderer/assets/template.ejs",
  48. // chunks: ['lib.min', 'serial']
  49. // }),
  50. // new HtmlWebpackPlugin({
  51. // filename: "aboutus.html",
  52. // template: "./src/renderer/assets/aboutus.ejs",
  53. // title: "About Us",
  54. // chunks: ['lib.min', 'about']
  55. // }),
  56. // new HtmlWebpackPlugin({
  57. // filename: "esptools.html",
  58. // template: "./src/renderer/assets/esptools.ejs",
  59. // title: "Esptools",
  60. // chunks: ['lib.min', 'esptools']
  61. // }),
  62. // new HtmlWebpackPlugin({
  63. // filename: "update.html",
  64. // template: "./src/renderer/assets/update.ejs",
  65. // title: "Update",
  66. // chunks: ['lib.min', 'update']
  67. // }),
  68. new CopyPlugin({
  69. patterns:[
  70. { from: __dirname + "/src/renderer/cocoblockly-x/", to: "cocoblockly-x/" },
  71. { from: __dirname + "/src/renderer/assets/upload_error.json" }]
  72. }),
  73. new HtmlWebpackPlugin({
  74. filename: "upload.html",
  75. template: "./src/renderer/assets/template.ejs",
  76. chunks: ['lib.min', 'upload']
  77. }),
  78. new CopyPlugin({
  79. patterns:[
  80. { from: __dirname + "/src/static/common/ccrb.key" }]
  81. }),
  82. new CopyPlugin({
  83. patterns:[
  84. { from: __dirname + "/src/static/common/ccrb.crt" }]
  85. })
  86. ]
  87. };
  88. module.exports = config;