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 CopyPlugin({
patterns:[
{ from: __dirname + "/src/renderer/cocoblockly-x/", to: "cocoblockly-x/" },
{ from: __dirname + "/src/renderer/assets/upload_error.json" }]
}),
new HtmlWebpackPlugin({
filename: "upload.html",
template: "./src/renderer/assets/template.ejs",
chunks: ['lib.min', 'upload']
}),
new CopyPlugin({
patterns:[
{ from: __dirname + "/src/static/common/ccrb.key" }]
}),
new CopyPlugin({
patterns:[
{ from: __dirname + "/src/static/common/ccrb.crt" }]
})
]
};
module.exports = config;