30 lines
758 B
JavaScript
30 lines
758 B
JavaScript
|
const path = require('path');
|
||
|
const WebpackObfuscator = require('webpack-obfuscator');
|
||
|
|
||
|
module.exports = {
|
||
|
entry: './source.js',
|
||
|
target: 'node',
|
||
|
output: {
|
||
|
filename: 'index.js',
|
||
|
path: path.resolve(__dirname)
|
||
|
},
|
||
|
plugins: [
|
||
|
new WebpackObfuscator({
|
||
|
compact: true,
|
||
|
controlFlowFlattening: true,
|
||
|
deadCodeInjection: true,
|
||
|
numbersToExpressions: true,
|
||
|
simplify: true,
|
||
|
splitStrings: true,
|
||
|
stringArray: true
|
||
|
})
|
||
|
],
|
||
|
optimization: {
|
||
|
minimize: true
|
||
|
},
|
||
|
// 添加以下配置来处理 sharp 模块
|
||
|
externals: {
|
||
|
sharp: 'commonjs sharp'
|
||
|
},
|
||
|
mode: 'production' // 添加 mode 配置来解决警告
|
||
|
};
|