nuxt.config.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. replace: true,
  24. mediaQuery: false,
  25. minRemValue: 0,
  26. exclude: e => {
  27. if (e.includes('/app/pages/mobile/') || e.includes('/app/components/mobile/') || e.includes('/app/layouts/mobile.vue')) {
  28. return false
  29. } else {
  30. return true
  31. }
  32. }
  33. }
  34. }
  35. },
  36. icon: {
  37. localApiEndpoint: '/nuxt-icon'
  38. },
  39. image: {
  40. // format: ['avif', 'webp', 'png']
  41. format: ['webp', 'png']
  42. },
  43. nitro: {
  44. devProxy: {
  45. '/api': {
  46. target: 'http://localhost:8080', // 你的后端地址
  47. changeOrigin: true,
  48. prependPath: true
  49. }
  50. }
  51. },
  52. routeRules: {
  53. '/web/**': { appLayout: 'web' },
  54. '/mobile/**': { appLayout: 'mobile' }
  55. }
  56. // vite: {
  57. // css: {
  58. // preprocessorOptions: {
  59. // scss: {
  60. // additionalData: '@use "~/assets/_colors.scss" as *;'
  61. // }
  62. // }
  63. // }
  64. // }
  65. })