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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import i18nConfig from "./i18n.config";
  2. import type { Strategies } from "@nuxtjs/i18n";
  3. // https://nuxt.com/docs/api/configuration/nuxt-config
  4. export default defineNuxtConfig({
  5. compatibilityDate: "2025-05-06",
  6. devtools: { enabled: true },
  7. // 添加CSS
  8. css: [
  9. "~/assets/css/tailwind.css",
  10. "~/assets/css/styles.css",
  11. "~/assets/icomoon/style.css",
  12. ],
  13. // 模块
  14. modules: ["@nuxtjs/i18n", "@nuxt/content"],
  15. // content模块配置
  16. content: {
  17. // 基础配置
  18. },
  19. // i18n 配置 (从外部文件加载)
  20. i18n: {
  21. ...i18nConfig,
  22. defaultLocale: i18nConfig.defaultLocale as 'zh' | 'en' | 'ja' | undefined,
  23. strategy: i18nConfig.strategy as Strategies, // 显式类型转换 strategy
  24. },
  25. // Typescript 配置
  26. typescript: {
  27. strict: true,
  28. shim: false,
  29. },
  30. // PostCSS配置 (统一到这里)
  31. postcss: {
  32. plugins: {
  33. tailwindcss: {},
  34. autoprefixer: {},
  35. },
  36. },
  37. // 编译配置
  38. build: {
  39. transpile: ["@nuxtjs/i18n"],
  40. },
  41. // 静态站点生成配置
  42. nitro: {
  43. prerender: {
  44. crawlLinks: true,
  45. routes: ["/"],
  46. ignore: [
  47. '/api/**',
  48. '/admin/**'
  49. ],
  50. failOnError: false
  51. },
  52. // 添加图片本地化配置
  53. publicAssets: [
  54. {
  55. dir: 'public',
  56. baseURL: '/'
  57. }
  58. ]
  59. },
  60. devServer: {
  61. host: "0.0.0.0",
  62. }
  63. });