/* eslint-env node */
const { configure } = require('quasar/wrappers')

module.exports = configure(function () {
  return {
    boot: ['pinia'],

    css: ['app.scss'],

    extras: ['roboto-font', 'material-icons'],

    build: {
      target: {
        browser: ['es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1'],
        node: 'node20',
      },
      vueRouterMode: 'hash',
      extendViteConf (viteConf) {
        viteConf.base = process.env.DEPLOY_BASE || '/assets/client-app/'
      },
    },

    devServer: {
      open: false,
      host: '0.0.0.0',
      port: 9002,
      proxy: {
        '/api': {
          target: 'https://erp.gigafibre.ca',
          changeOrigin: true,
        },
      },
    },

    framework: {
      config: {},
      plugins: ['Notify', 'Loading', 'Dialog'],
    },

    animations: [],

    pwa: {
      workboxMode: 'generateSW',
      injectPwaMetaTags: true,
      swFilename: 'sw.js',
      manifestFilename: 'manifest.json',
      useCredentialForManifestTag: false,
      workboxOptions: {
        skipWaiting: true,
        clientsClaim: true,
        cleanupOutdatedCaches: true,
        navigateFallback: 'index.html',
        navigateFallbackDenylist: [/^\/api\//],
      },
      extendManifestJson (json) {
        json.name = 'Gigafibre'
        json.short_name = 'Gigafibre'
        json.description = 'Portail client Gigafibre'
        json.display = 'standalone'
        json.background_color = '#ffffff'
        json.theme_color = '#0ea5e9'
        json.start_url = '.'
      },
    },
  }
})
