nuxt.config.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // https://nuxt.com/docs/api/configuration/nuxt-config
  2. export default defineNuxtConfig({
  3. srcDir: "src",
  4. modules: [
  5. "@vant/nuxt",
  6. [
  7. "@pinia/nuxt",
  8. {
  9. autoImports: ["defineStore", "storeToRefs"],
  10. },
  11. ],
  12. ],
  13. runtimeConfig: {
  14. public: {
  15. baseApi: process.env.VITE_APP_BASE_URL,
  16. },
  17. },
  18. imports: {
  19. dirs: ["stores", "api"],
  20. },
  21. compatibilityDate: "2024-04-03",
  22. devtools: { enabled: false },
  23. app: {
  24. head: {
  25. title: "逍遥游",
  26. meta: [
  27. {
  28. name: "charset",
  29. content: "utf-8",
  30. },
  31. // {
  32. // name: "viewport",
  33. // content: "width=device-width,width=1250,maximum-scale=1.0",
  34. // },
  35. {
  36. name: "renderer",
  37. content: "webkit",
  38. },
  39. ],
  40. },
  41. },
  42. css: ["@/assets/css/tailwind.css"],
  43. postcss: {
  44. plugins: {
  45. tailwindcss: {},
  46. "postcss-px-to-viewport-8-plugin": {
  47. unitToConvert: "px",
  48. viewportWidth: 375,
  49. unitPrecision: 2,
  50. viewportUnit: "vw", // 指定需要转换成的视窗单位,默认vw
  51. fontViewportUnit: "vw", // 指定字体需要转换成的视窗单位,默认vw
  52. propList: ["*", "!border-radius"], // 能转化为vw的属性列表
  53. selectorBlackList: [], // 需要忽略的CSS选择器,不会转为视口单位,使用原有的px等单位。
  54. minPixelValue: 1, // 设置最小的转换数值,如果为1的话,只有大于1的值会被转换
  55. mediaQuery: false, // 媒体查询里的单位是否需要转换单位
  56. replace: true, // 是否直接更换属性值,而不添加备用属性
  57. exclude: [/node_modules/], // 忽略某些文件夹下的文件或特定文件,例如 'node_modules' 下的文件
  58. landscape: false, // 是否添加根据 landscapeWidth 生成的媒体查询条件 @media (orientation: landscape)
  59. landscapeUnit: "vw", // 横屏时使用的单位
  60. landscapeWidth: 1920, // 横屏时使用的视口宽度
  61. },
  62. },
  63. },
  64. });