Source: nuxt.config.js

/**
 ** Copyright © 2022-2025 The CTAN Team and individual authors
 **
 ** This file is distributed under the 3-clause BSD license.
 ** See file LICENSE for details.
 **/
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'

export default defineNuxtConfig({
  /**
   * 
   */
  build: {
    transpile: ['vuetify'],
  },

  /**
   * 
   */
  css: [
    '@fontsource/open-sans',
    '~/assets/css/main.scss',
    '~/assets/css/logo.scss'
  ],

  /**
   * 
   */
  defaultAssets: false,

  /**
   *
   */
  devtools: { enabled: false },

  /**
   * 
   */
  head: {
    title: 'CTAN',
  },

  /**
   * 
   */
  modules: [
    '@pinia/nuxt',
    'nuxt-icons',
    (_options, nuxt) => {
      nuxt.hooks.hook('vite:extendConfig', (config) => {
        // @ts-expect-error
        config.plugins.push(vuetify({ autoImport: true }))
      })
    },
    //...
  ],

  /**
   * 
   */
  nitro: {
    routeRules: {
      '/api/**': { 
        proxy: { 
          to: 'http://localhost:9000/api/**' // Make sure this is an ENV driven variable if production does not match
        }
      },
      '/json/**': { 
        proxy: { 
          to: 'http://localhost:9000/api/json/**'
        }
      },
      '/xml/**': { 
        proxy: { 
          to: 'http://localhost:9000/api/xml/**'
        }
      }
    }
  },

  /**
   * 
   */
  pinia: {
    storesDirs: ['./stores/**'],
  },

  /**
   * Route rules are used to redirect some URLs to existing pages on other
   * locations.
   */
  routeRules:{
    '/ctan': { redirect: { to: '/help/ctan', statusCode: 301 } },
    '/tex': { redirect: { to: '/help/tex', statusCode: 301 } },
    '/TDS-guidelines': { redirect: { to: '/help/tds', statusCode: 301 } },    
    '/news': { redirect: { to: '/ctan-ann', statusCode: 301 } },

    // Mapping of ancient URLs
    '/ctan.html': { redirect: { to: '/', statusCode: 301 } },
    '/mirroring': { redirect: { to: '/mirror/register', statusCode: 301 } },
    '/search.html': { redirect: { to: '/search', statusCode: 301 } },
    '/starter.html': { redirect: { to: '/help/starter', statusCode: 301 } },
    '/what_is_tex.html': { redirect: { to: '/help/tex', statusCode: 301 } },

    '/az': { redirect: { statusCode: 410 } },
    '/characterization': { redirect: { statusCode: 410 } },
    '/characterization/**': { redirect: { statusCode: 410 } },
    '/edit_keywords': { redirect: { statusCode: 410 } },
    '/keyword': { redirect: { statusCode: 410 } },
    '/keyword/**': { redirect: { statusCode: 410 } }
    /*
       "/help/changelog_$id"              ( view: '/error/410' )
    */
  },

  /**
   * Disable server side rendering.
   */
  ssr: false,

  /**
   * 
   */
  treeShake: true,

  /**
   * 
   */
  vite: {
    vue: {
      template: {
        transformAssetUrls,
      },
    },
  },

  /**
   * 
   */
  vuetify: {
    customVariables: ['~/assets/variables.scss']
  },

  compatibilityDate: '2024-08-24'
})