nuxt.config.ts 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // https://nuxt.com/docs/api/configuration/nuxt-config
  2. export default defineNuxtConfig({
  3. srcDir: "src",
  4. modules: [
  5. "@vant/nuxt",
  6. "nuxt-swiper",
  7. "@vueuse/nuxt",
  8. "dayjs-nuxt",
  9. "@samk-dev/nuxt-vcalendar",
  10. [
  11. "@pinia/nuxt",
  12. {
  13. autoImports: ["defineStore", "storeToRefs"],
  14. },
  15. ],
  16. ],
  17. dayjs: {
  18. plugins: [
  19. "isSameOrAfter",
  20. "isSameOrBefore",
  21. "isToday",
  22. "customParseFormat",
  23. "minMax",
  24. ],
  25. },
  26. runtimeConfig: {
  27. public: {
  28. baseApi: process.env.VITE_APP_BASE_URL,
  29. },
  30. },
  31. imports: {
  32. dirs: ["stores", "api"],
  33. },
  34. compatibilityDate: "2024-04-03",
  35. devtools: { enabled: false },
  36. app: {
  37. head: {
  38. title: "逍遥游",
  39. meta: [
  40. {
  41. name: "charset",
  42. content: "utf-8",
  43. },
  44. {
  45. name: "viewport",
  46. content:
  47. "width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover",
  48. },
  49. {
  50. name: "renderer",
  51. content: "webkit",
  52. },
  53. ],
  54. link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.svg" }],
  55. // script: [
  56. // {
  57. // src: "https://cdn.jsdelivr.net/npm/eruda",
  58. // type: "text/javascript",
  59. // },
  60. // {
  61. // innerHTML: "eruda.init();",
  62. // },
  63. // {
  64. // src: "//unpkg.com/vconsole@latest/dist/vconsole.min.js",
  65. // type: "text/javascript",
  66. // },
  67. // { innerHTML: "new VConsole()" },
  68. // ],
  69. },
  70. },
  71. css: ["@/assets/css/tailwind.css", "./src/assets/iconfont/iconfont.css"],
  72. postcss: {
  73. plugins: {
  74. tailwindcss: {},
  75. "postcss-px-to-viewport-8-plugin": {
  76. unitToConvert: "px",
  77. viewportWidth: 375,
  78. unitPrecision: 2,
  79. viewportUnit: "vw", // 指定需要转换成的视窗单位,默认vw
  80. fontViewportUnit: "vw", // 指定字体需要转换成的视窗单位,默认vw
  81. propList: ["*", "!border-radius"], // 能转化为vw的属性列表
  82. selectorBlackList: [], // 需要忽略的CSS选择器,不会转为视口单位,使用原有的px等单位。
  83. minPixelValue: 1, // 设置最小的转换数值,如果为1的话,只有大于1的值会被转换
  84. mediaQuery: false, // 媒体查询里的单位是否需要转换单位
  85. replace: true, // 是否直接更换属性值,而不添加备用属性
  86. exclude: [/node_modules/], // 忽略某些文件夹下的文件或特定文件,例如 'node_modules' 下的文件
  87. landscape: false, // 是否添加根据 landscapeWidth 生成的媒体查询条件 @media (orientation: landscape)
  88. landscapeUnit: "vw", // 横屏时使用的单位
  89. landscapeWidth: 1920, // 横屏时使用的视口宽度
  90. },
  91. },
  92. },
  93. });