Hanye官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nuxt.config.ts 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import i18nConfig from "./i18n.config";
  2. import type { Strategies } from "@nuxtjs/i18n";
  3. import { resolve } from 'path';
  4. // https://nuxt.com/docs/api/configuration/nuxt-config
  5. export default defineNuxtConfig({
  6. compatibilityDate: "2025-05-06",
  7. devtools: { enabled: true },
  8. // 添加CSS
  9. css: [
  10. "~/assets/css/tailwind.css",
  11. "~/assets/css/styles.css",
  12. "~/assets/icomoon/style.css",
  13. ],
  14. // 模块
  15. modules: ["@nuxtjs/i18n", "@nuxt/content"],
  16. // content模块配置
  17. content: {
  18. // 配置导航
  19. navigation: {
  20. fields: ['title', 'description', 'category']
  21. },
  22. // 配置 Markdown
  23. markdown: {
  24. // 启用目录
  25. toc: {
  26. depth: 3,
  27. searchDepth: 3
  28. },
  29. // 启用高亮
  30. highlight: {
  31. theme: 'github-dark'
  32. }
  33. }
  34. },
  35. // i18n 配置 (从外部文件加载)
  36. i18n: {
  37. ...i18nConfig,
  38. defaultLocale: i18nConfig.defaultLocale as 'zh' | 'en' | 'ja' | undefined,
  39. strategy: i18nConfig.strategy as Strategies, // 显式类型转换 strategy
  40. },
  41. // Typescript 配置
  42. typescript: {
  43. strict: true,
  44. shim: false,
  45. },
  46. // PostCSS配置 (统一到这里)
  47. postcss: {
  48. plugins: {
  49. tailwindcss: {},
  50. autoprefixer: {},
  51. },
  52. },
  53. // 编译配置
  54. build: {
  55. transpile: ["@nuxtjs/i18n"],
  56. },
  57. // 静态站点生成配置
  58. nitro: {
  59. prerender: {
  60. crawlLinks: true,
  61. routes: [
  62. '/',
  63. '/products',
  64. '/faq',
  65. '/contact',
  66. '/about',
  67. '/en',
  68. '/ja',
  69. '/zh'
  70. ],
  71. ignore: [
  72. '/api/**',
  73. '/admin/**'
  74. ],
  75. failOnError: false
  76. },
  77. // 添加图片本地化配置
  78. publicAssets: [
  79. {
  80. dir: 'public',
  81. baseURL: '/'
  82. }
  83. ]
  84. },
  85. devServer: {
  86. host: "0.0.0.0",
  87. }
  88. });