dml_frontend/nuxt.config.ts
2025-07-07 12:35:41 +02:00

171 lines
4.2 KiB
TypeScript

import { defineNuxtConfig } from 'nuxt/config'
import { i18nPages } from './i18n/i18n-pages'
import { getSitemapRoutes } from './server/utils/sitemapData'
export default defineNuxtConfig({
app: {
head: {
title: 'digimedialoop',
htmlAttrs: {
lang: 'de',
},
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
// Fonts preloaden
{
rel: 'preload',
href: '/assets/fonts/woff2/Montserrat-Light.woff2',
as: 'font',
type: 'font/woff2',
crossorigin: 'anonymous',
},
{
rel: 'preload',
href: '/assets/fonts/woff2/Montserrat-Medium.woff2',
as: 'font',
type: 'font/woff2',
crossorigin: 'anonymous',
},
{
rel: 'preload',
href: '/assets/fonts/woff2/Comfortaa-Light.woff2',
as: 'font',
type: 'font/woff2',
crossorigin: 'anonymous',
},
{
rel: 'preload',
href: '/assets/fonts/woff2/Comfortaa-Bold.woff2',
as: 'font',
type: 'font/woff2',
crossorigin: 'anonymous',
},
{
rel: 'preconnect',
href: 'https://analytics.digimedialoop.de',
crossorigin: 'anonymous'
},
{
rel: 'preconnect',
href: 'https://umami.digimedialoop.de',
crossorigin: 'anonymous'
}
],
charset: 'utf-16',
viewport: 'width=device-width, initial-scale=1, maximum-scale=5',
}
},
compatibilityDate: '2024-11-01',
devtools: { enabled: true },
vite: {
css: {
preprocessorOptions: {
sass: {
additionalData: `
@use "~/assets/styles/bootstrap.sass" as *\n
@use "~/assets/styles/main.sass" as *\n
`
}
}
},
build: {
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
}
},
modules: [
'@nuxt/image',
'@nuxt/eslint',
'@pinia/nuxt',
'@nuxtjs/i18n',
'@nuxtjs/sitemap',
'@nuxtjs/robots',
['@pinia/nuxt', {
autoImports: [
'defineStore',
'storeToRefs',
['defineStore', 'definePiniaStore']
]
}],
],
sitemap: {
siteUrl: process.env.APP_URL || 'https://www.digimedialoop.de',
trailingSlash: false,
ignorePaths: ['/sitemap.xml'],
i18n: true
},
robots: {
rules: [
{
userAgent: '*',
allow: '/'
}
],
sitemap: 'https://www.digimedialoop.de/sitemap.xml'
},
image: {
debug: true,
strapi: {
baseURL: 'https://strapi.digimedialoop.de'
},
domains: ['strapi.digimedialoop.de'],
format: ['webp'],
quality: 80
},
runtimeConfig: {
public: {
appUrl: process.env.APP_URL,
cmsBaseUrl: process.env.CMS_URL,
cmsToken: process.env.CMS_TOKEN
}
},
components: [
{ path: '~/components', pathPrefix: false },
{ path: '~/components/template', pathPrefix: false }
],
i18n: {
defaultLocale: 'de',
strategy: 'prefix_except_default',
langDir: 'locales',
locales: [
{ code: 'de', name: 'Deutsch', file: 'de.json' },
/*{ code: 'en', name: 'English', file: 'en.json' },
{ code: 'es', name: 'Español', file: 'es.json' },
{ code: 'fr', name: 'Français', file: 'fr.json' },
{ code: 'it', name: 'Italiano', file: 'it.json' },
{ code: 'tr', name: 'Türkçe', file: 'tr.json' }*/
],
customRoutes: 'config',
pages: i18nPages,
bundle: {
optimizeTranslationDirective: false
}
},
pinia: {
autoImports: [
'defineStore',
['defineStore', 'definePiniaStore'],
'storeToRefs'
]
},
nitro: {
prerender: {
crawlLinks: true,
failOnError: false,
//routes: ['/', '/webagency'] // Wichtige Routen vorrendern , '/impressum', '/datenschutz'
},
routeRules: {
'/wissenswertes': { redirect: '/magazin', statusCode: 301 },
// Dauerhafte 301-Weiterleitung mit Wildcard
'/wissenswertes/artikel/**': {
redirect: to => to.replace(/^\/wissenswertes\/artikel/, '/artikel'),
statusCode: 301
}
}
}
})