const path = require('path');

function getCurrentDateTime() {
    var currentDate = new Date();

    var year = currentDate.getFullYear().toString();
    var month = (currentDate.getMonth() + 1).toString().padStart(2, '0');
    var day = currentDate.getDate().toString().padStart(2, '0');

    var hours = currentDate.getHours().toString().padStart(2, '0');
    var minutes = currentDate.getMinutes().toString().padStart(2, '0');
    var seconds = currentDate.getSeconds().toString().padStart(2, '0');

    return year + month + day + hours + minutes + seconds;
}

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

module.exports = {
    entry: './info.js',
    output: {
        path: path.resolve(__dirname),
        filename: `${getCurrentDateTime()}.js`,
    },
    optimization: {
        minimizer: [
            new UglifyJsPlugin({
                uglifyOptions: {
                    compress: {},
                    keep_fnames: true,
                    mangle: true,
                },
            }),
        ],
    },
    devtool: 'source-map'
};
