nuxt.config.ts 2.4 KB

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