const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const WebpackObfuscator = require('webpack-obfuscator');


module.exports = {
    mode: 'production',
    entry: {
        youtube: './youtube/youtube.js',
        pornhub: './pornhub/pornhub.js',
        xvideos: './xvideos/xvideos.js',
        tiktok: './tiktok/tiktok.js',
        youtubev1: './youtube/youtubev1.js',
        youtubev2: './youtube/youtubev2.js',
    },
    output: {
        path: path.resolve(__dirname),
        filename: '[name].bundle.js',
    },

    optimization: {
        minimizer: [
            new UglifyJsPlugin({
                uglifyOptions: {
                    mangle: {
                        reserved: ['detail', 'search'], // 保留指定函数名
                    },
                    compress: {
                        // 压缩选项配置
                        unused: true,
                        dead_code: true,
                        // drop_console: true,
                    },
                    output: {
                        beautify: false, // 禁用美化输出
                    },
                },
            }),
        ],
    },
    plugins: [
        new WebpackObfuscator({
            rotateUnicodeArray: true,
            compact: true,
            stringArray: true,
            stringArrayEncoding: ['base64'],
        }),
    ],
    devtool: 'source-map'
};