-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
52 lines (51 loc) · 2.19 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const WebpackObfuscator = require('webpack-obfuscator');
module.exports = {
entry: './src/index.js', // Entry point for your application
output: {
path: path.resolve(__dirname, 'dist'), // Output directory
filename: 'bundle.js', // Output file name
},
mode: 'production', // Use 'development' for development builds
target: 'electron-main', // Target Electron main process
externals: [
nodeExternals({
allowlist: ['src/'] // Optionally include specific modules
})
],
module: {
rules: [
{
test: /\.js$/, // Apply this rule to all JavaScript files
exclude: /node_modules/,
use: {
loader: 'babel-loader', // Use Babel for transpiling
options: {
presets: ['@babel/preset-env'], // Use the preset for ES6+ features
plugins: ['transform-remove-console'] // Add the plugin here if needed
},
},
},
],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'src/index.html', to: 'index.html' }, // Copy HTML file
{ from: 'src/styles.css', to: 'styles.css' }, // Copy CSS file
{ from: 'src/preload.js', to: 'preload.js' }, // Copy preload script
{ from: 'src/renderer.js', to: 'renderer.js' }, // Copy renderer script
{ from: 'src/pokemon_names.csv', to: 'pokemon_names.csv' }, // Copy pokemon names list
{ from: 'src/icons/delete.png', to: 'icons/delete.png' }, // Copy icons directory
{ from: 'src/icons/upload.png', to: 'icons/upload.png' }, // Copy icons directory
{ from: 'src/icons/download.png', to: 'icons/download.png' }, // Copy icons directory
],
}),
// Uncomment if you want to use obfuscation
new WebpackObfuscator({
rotateUnicodeArray: true, // Obfuscate JavaScript code
}, []),
],
};