12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import i18nConfig from "./i18n.config";
- import type { Strategies } from "@nuxtjs/i18n";
-
- // 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: {
- // 基础配置
- },
-
- // 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: ["/"],
- ignore: [
- '/api/**',
- '/admin/**'
- ],
- failOnError: false
- },
- // 添加图片本地化配置
- publicAssets: [
- {
- dir: 'public',
- baseURL: '/'
- }
- ]
- },
-
- devServer: {
- host: "0.0.0.0",
- }
- });
|