// https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ compatibilityDate: '2025-07-15', devtools: { enabled: true }, modules: ['@nuxtjs/i18n'], css: ['katex/dist/katex.min.css', '~/assets/css/main.scss'], /* The interface language (app -> t('...'), catalogues in i18n/locales/). It is a preference, never part of the address — /wiki// speaks of the *article's* language, so the UI stays unprefixed. On a first load the saved choice comes from the `mathew-locale` cookie (which the server can read, so pages render in the right language before any script runs), then the browser's own. A signed-in account's stored choice is applied over these at startup — see app/plugins/auth.ts. */ i18n: { strategy: 'no_prefix', defaultLocale: 'en', locales: [ { code: 'en', language: 'en-US', name: 'English', file: 'en.json' }, { code: 'es', language: 'es-ES', name: 'Español', file: 'es.json' }, { code: 'ca', language: 'ca-ES', name: 'Català', file: 'ca.json' }, { code: 'fr', language: 'fr-FR', name: 'Français', file: 'fr.json' }, { code: 'de', language: 'de-DE', name: 'Deutsch', file: 'de.json' }, ], // The catalogues are small; bundling them keeps locale switches instant lazy: false, // Messages carry their own markup ( in the API banner, the hero // gradient, demo words in the cheatsheet), rendered with v-html compilation: { strictMessage: false }, detectBrowserLanguage: { useCookie: true, cookieKey: 'mathew-locale', fallbackLocale: 'en', }, }, runtimeConfig: { public: { // Where the UI calls the API. The Docker image sets this to "" so the // browser calls /api on its own origin and nginx routes it to the // backend; dev keeps the absolute localhost address. apiBase: process.env.NUXT_PUBLIC_API_BASE ?? 'http://localhost:5000', }, }, // The Nuxt server's own API calls (SSR) are relative once apiBase is "", // and land on this Nitro route, which forwards them to the backend. The // Docker image bakes NUXT_API_PROXY_TARGET=https://mathew.aranroig.com in // at build; nginx routes that address on to the backend. routeRules: { '/api/**': { proxy: `${process.env.NUXT_API_PROXY_TARGET || 'http://localhost:5000'}/api/**` }, }, app: { head: { meta: [ { name: 'description', content: 'A modern, collaborative wiki for mathematical concepts — written in Markdown, rendered with LaTeX.', }, { name: 'theme-color', media: '(prefers-color-scheme: light)', content: '#f7f8fb' }, { name: 'theme-color', media: '(prefers-color-scheme: dark)', content: '#0a0c12' }, ], script: [ { // Apply saved theme & accent before first paint to avoid a flash tagPosition: 'head', innerHTML: "(function(){try{var d=document.documentElement;var s=localStorage.getItem('mathew-theme');var t=s||(window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light');d.setAttribute('data-theme',t);var a=localStorage.getItem('mathew-accent');if(a&&a!=='violet')d.setAttribute('data-accent',a);}catch(e){}})();", }, ], }, }, })