const GitCommitInfoWebpackPlugin = require("git-commit-info-webpack-plugin");

var fs = require('fs');
module.exports = {
    assetsDir: 'static',
    transpileDependencies: [
        "vuetify"
    ],
    configureWebpack: {
        plugins: [
            new GitCommitInfoWebpackPlugin({
                pathToFile: './',
                filename: 'git_info.json'
              })
        ]
      },
    chainWebpack: (config) => {
        // Remove the following lines to add Vue Prefetch and Preload on index.html
        // https://cli.vuejs.org/guide/html-and-static-assets.html#disable-index-generation
        config.plugins.delete('preload')
        config.plugins.delete('prefetch')
      },
    devServer: {
        host: 'local.com',
        https: {
            key: fs.readFileSync('./server.key'),
            cert: fs.readFileSync('./server.cert')
        },
        historyApiFallback: {
            rewrites: [
                //{ from: /\/gate/, to: '/gate.html' },               
                //{ from: /\/retailer/, to: '/retailer.html' },                              
                { from: /\//, to: '/index.html' }
            ]
        }
    },

    pluginOptions: {
        s3Deploy: {
            registry: undefined,
            awsProfile: 'crane',
            region: process.env.DEPLOY_S3_REGION,
            bucket: process.env.DEPLOY_S3_BUCKET,
            createBucket: false,
            staticHosting: false,
            staticIndexPage: 'index.html',
            staticErrorPage: 'index.html',
            assetPath: 'dist',
            assetMatch: '**',
            deployPath: '/',
            acl: 'public-read',
            pwa: false,
            enableCloudfront: true,
            cloudfrontId: process.env.DEPLOY_CLOUDFRONT_ID,
            cloudfrontMatchers: '/*',
            uploadConcurrency: 5,
            pluginVersion: '3.0.0'
        },
        critical: {
            width: 375,
            height: 565    
        }
    }
}