const mix = require('laravel-mix');
const S3PusherPlugin = require('webpack-s3-pusher');
require('laravel-mix-versionhash');

if (mix.inProduction()) {
    mix.webpackConfig({
        plugins: [
            new S3PusherPlugin({
                key: process.env.AWS_ACCESS_KEY_ID,
                secret: process.env.AWS_SECRET_ACCESS_KEY,
                bucket: "cdn",
                region: process.env.AWS_DEFAULT_REGION,
                endpoint: process.env.AWS_ENDPOINT,
                prefix: 'lubo',
            })
        ]
    });
}
/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel applications. By default, we are compiling the CSS
 | file for the application as well as bundling up all the JS files.
 |
 */

mix
    .js('resources/js/component/from_select.js', 'public/js/component')
    .js('resources/js/app.js', 'public/js')
    .extract(['axios', 'lodash'])
    .js('resources/js/webauthn.js', 'public/js')
    .copy('resources/css/vendor', 'public/css/vendor')
    .postCss('resources/css/app.css', 'public/css', [
        require('tailwindcss')
    ])
    .disableNotifications();
if (mix.inProduction()) {
    mix.versionHash();
} else {
    mix.sourceMaps()
}