import i18nConfig from "./i18n.config";
import type { Strategies } from "@nuxtjs/i18n";

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: "2024-11-01",
  devtools: { enabled: true },

  // 添加CSS
  css: [
    "~/assets/css/tailwind.css",
    "~/assets/css/styles.css",
    "~/assets/icomoon/style.css",
  ],

  // 模块
  modules: ["@nuxtjs/i18n"],

  // 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: ["/"],
    },
  },

  devServer: {
    host: "0.0.0.0",
  },
});
