webpack.config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const path = require('path');
  2. const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
  3. const WebpackObfuscator = require('webpack-obfuscator');
  4. module.exports = {
  5. mode: 'production',
  6. entry: {
  7. youtube: './youtube/youtube.js',
  8. pornhub: './pornhub/pornhub.js',
  9. xvideos: './xvideos/xvideos.js',
  10. tiktok: './tiktok/tiktok.js',
  11. youtube_audio: './youtube/youtube_audio.js',
  12. },
  13. output: {
  14. path: path.resolve(__dirname),
  15. filename: '[name].bundle.js',
  16. },
  17. optimization: {
  18. minimizer: [
  19. new UglifyJsPlugin({
  20. uglifyOptions: {
  21. mangle: {
  22. reserved: ['detail', 'search'], // 保留指定函数名
  23. },
  24. compress: {
  25. // 压缩选项配置
  26. unused: true,
  27. dead_code: true,
  28. // drop_console: true,
  29. },
  30. output: {
  31. beautify: false, // 禁用美化输出
  32. },
  33. },
  34. }),
  35. ],
  36. },
  37. plugins: [
  38. new WebpackObfuscator({
  39. rotateUnicodeArray: true,
  40. compact: true,
  41. stringArray: true,
  42. stringArrayEncoding: ['base64'],
  43. }),
  44. ],
  45. devtool: 'source-map'
  46. };