- 在package.json中添加webpack相关依赖并更新sharp版本 - 新增webpack配置用于代码混淆和打包优化 - 实现缩略图生成功能,当API返回thumb参数时自动创建缩略图 - 重构缓存服务逻辑,优化响应头处理和错误处理 - 移除不必要的path模块引入并统一代码风格
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 配置来解决警告
|
|
}; |