-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
35 lines (31 loc) · 940 Bytes
/
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
const path = require('path');
const fs = require('fs');
const JavaScriptObfuscator = require('webpack-obfuscator');
// Directory containing your JavaScript files
const jsFilesDir = path.resolve(__dirname, './staticfiles/main/js');
// Generate entry points for all JavaScript files in the directory
const entryPoints = {};
fs.readdirSync(jsFilesDir).forEach(file => {
if (file.endsWith('.js')) {
const fileName = file.replace('.js', '');
entryPoints[fileName] = path.join(jsFilesDir, file);
}
});
module.exports = {
mode: 'production', // or 'development'
entry: entryPoints,
output: {
filename: '[name].obfuscated.js',
path: path.resolve(__dirname, 'staticfiles/main/js')
},
module: {
rules: [
// Add any necessary loaders here
],
},
plugins: [
new JavaScriptObfuscator({
rotateUnicodeArray: true,
}),
],
};