123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
- const CopyPlugin = require('copy-webpack-plugin');
- let config = {
- devtool: 'source-map',
- mode: 'production',
- target: "electron-renderer",
- entry: {
- index: "./src/renderer/index.js",
- serial: "./src/renderer/handler.js",
- about: "./src/renderer/about.js",
- esptools: "./src/renderer/esptools.js",
- update: "./src/renderer/update.js"
- },
- output: {
- path: __dirname + "/dist/renderer/",
- filename: "[name].js"
- },
- optimization: {
- minimize: false,
- // minimizer: [
- // new UglifyJSPlugin({
- // parallel: true,
- // sourceMap: true
- // })
- // ],
- splitChunks: {
- chunks: 'all',
- minSize: 30000,
- minChunks: 1,
- maxAsyncRequests: 5,
- maxInitialRequests: 3,
- name: 'lib.min'
- },
- runtimeChunk: {
- name: 'lib.min'
- }
- },
- plugins: [
- new HtmlWebpackPlugin({
- filename: "index.html",
- template: "./src/renderer/assets/template.ejs",
- chunks: ['lib.min', 'index']
- }),
- new HtmlWebpackPlugin({
- filename: "serialport.html",
- template: "./src/renderer/assets/template.ejs",
- chunks: ['lib.min', 'serial']
- }),
- new HtmlWebpackPlugin({
- filename: "aboutus.html",
- template: "./src/renderer/assets/aboutus.ejs",
- title: "About Us",
- chunks: ['lib.min', 'about']
- }),
- new HtmlWebpackPlugin({
- filename: "esptools.html",
- template: "./src/renderer/assets/esptools.ejs",
- title: "Esptools",
- chunks: ['lib.min', 'esptools']
- }),
- new HtmlWebpackPlugin({
- filename: "update.html",
- template: "./src/renderer/assets/update.ejs",
- title: "Update",
- chunks: ['lib.min', 'update']
- }),
- new HtmlWebpackPlugin({
- filename: "upload.html",
- template: "./src/renderer/assets/template.ejs",
- chunks: ['lib.min', 'upload']
- }),
- new CopyPlugin({
- patterns: [
- { from: __dirname + "/src/renderer/assets/upload_error.json" }]
- }),
- new CopyPlugin({
- patterns: [
- { from: __dirname + "/src/static/common/ccrb.key" }]
- }),
- new CopyPlugin({
- patterns: [
- { from: __dirname + "/src/renderer/cocoblockly-x/", to: "cocoblockly-x/" }]
- }),
- new CopyPlugin({
- patterns: [
- { from: __dirname + "/src/static/common/ccrb.crt" }]
- })
- ]
- };
- module.exports = config;
|