nuxt.config.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // https://nuxt.com/docs/api/configuration/nuxt-config
  2. export default defineNuxtConfig({
  3. modules: ['@vueuse/nuxt', '@pinia/nuxt', '@nuxt/icon', '@nuxt/image', '@vant/nuxt'],
  4. compatibilityDate: '2025-07-15',
  5. // devtools: { enabled: true },
  6. css: ['~/assets/scss/main.scss'], // 全局样式文件
  7. plugins: ['~/plugins/index.js'],
  8. app: {
  9. head: {
  10. meta: [{ name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' }]
  11. }
  12. },
  13. postcss: {
  14. plugins: {
  15. autoprefixer: {
  16. overrideBrowserslist: ['last 15 versions']
  17. },
  18. 'postcss-pxtorem': {
  19. rootValue: 37.5,
  20. unitPrecision: 4,
  21. propList: ['*'],
  22. selectorBlackList: [
  23. 'html',
  24. 'body',
  25. // 排除所有不以 mb- 开头的类选择器
  26. /^\.(?!mb-)/
  27. ],
  28. replace: true,
  29. mediaQuery: false,
  30. minRemValue: 0
  31. }
  32. }
  33. },
  34. icon: {
  35. localApiEndpoint: '/nuxt-icon'
  36. },
  37. image: {
  38. // format: ['avif', 'webp', 'png']
  39. format: ['webp', 'png']
  40. },
  41. nitro: {
  42. devProxy: {
  43. '/api': {
  44. target: 'http://localhost:8080', // 你的后端地址
  45. changeOrigin: true,
  46. prependPath: true
  47. }
  48. }
  49. },
  50. routeRules: {
  51. '/web/**': { appLayout: 'web' },
  52. '/mobile/**': { appLayout: 'mobile' }
  53. }
  54. // vite: {
  55. // css: {
  56. // preprocessorOptions: {
  57. // scss: {
  58. // additionalData: '@use "~/assets/_colors.scss" as *;'
  59. // }
  60. // }
  61. // }
  62. // }
  63. })