// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  modules: ['@vueuse/nuxt', '@pinia/nuxt', '@nuxt/icon', '@nuxt/image'],
  compatibilityDate: '2025-07-15',
  // devtools: { enabled: true },
  css: ['~/assets/scss/main.scss'], // 全局样式文件
  plugins: ['~/plugins/index.js'],
  icon: {
    localApiEndpoint: '/nuxt-icon'
  },
  image: {
    // format: ['avif', 'webp', 'png']
    format: ['webp', 'png']
  },
  experimental: {
    payloadExtraction: true // 关键：启用 payload 提取
  },
  nitro: {
    devProxy: {
      '/api': {
        target: 'http://localhost:8080', // 你的后端地址
        changeOrigin: true,
        prependPath: true
      }
    }
  },
  routeRules: {
    '/web/**': { appLayout: 'web' },
    '/mobile/**': { appLayout: 'mobile' }
  },
  // vite: {
  //   css: {
  //     preprocessorOptions: {
  //       scss: {
  //         additionalData: '@use "~/assets/_colors.scss" as *;'
  //       }
  //     }
  //   }
  // }
})
