import i18nConfig from "./i18n.config"; import type { Strategies } from "@nuxtjs/i18n"; import { resolve } from 'path'; // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ compatibilityDate: "2025-05-06", devtools: { enabled: true }, // 添加CSS css: [ "~/assets/css/tailwind.css", "~/assets/css/styles.css", "~/assets/icomoon/style.css", ], // 模块 modules: ["@nuxtjs/i18n", "@nuxt/content"], // content模块配置 content: { // 配置导航 navigation: { fields: ['title', 'description', 'category'] }, // 配置 Markdown markdown: { // 启用目录 toc: { depth: 3, searchDepth: 3 }, // 启用高亮 highlight: { theme: 'github-dark' } } }, // i18n 配置 (从外部文件加载) i18n: { ...i18nConfig, defaultLocale: i18nConfig.defaultLocale as 'zh' | 'en' | 'ja' | undefined, strategy: i18nConfig.strategy as Strategies, // 显式类型转换 strategy }, // Typescript 配置 typescript: { strict: true, shim: false, }, // PostCSS配置 (统一到这里) postcss: { plugins: { tailwindcss: {}, autoprefixer: {}, }, }, // 编译配置 build: { transpile: ["@nuxtjs/i18n"], }, // 静态站点生成配置 nitro: { prerender: { crawlLinks: true, routes: [ '/', '/products', '/faq', '/contact', '/about', '/en', '/ja', '/zh' ], ignore: [ '/api/**', '/admin/**' ], failOnError: false }, // 添加图片本地化配置 publicAssets: [ { dir: 'public', baseURL: '/' } ] }, devServer: { host: "0.0.0.0", } });