export default defineNuxtConfig({
  taget: "static",
  compatibilityDate: '2024-04-03',
  devtools: { enabled: true },
  module: [
    '@nuxtjs/style-resources',
    '@element-plus/nuxt',
    "@gauseen/nuxt-proxy",
    '@pinia/nuxt',
  ],
  css: [
    '~/assets/css/global.css',
    '~/assets/css/font.css',
    'element-plus/dist/index.css',
    'element-plus/theme-chalk/display.css'
  ],
  // router: {
  //   // middleware: ['auth']
  //   mode: 'hash',
  // },
  router: {
    extendRoutes(routes, resolve) {
      const targetPageRoute = routes.find(route => route.path === '/target - page');
      if (targetPageRoute) {
        targetPageRoute.meta = targetPageRoute.meta || {};
        targetPageRoute.meta.noCache = true;
      }
    }
  },
  build: {
    publicPath: '/'
  },
  nitro: {
    output: {
      publicDir: "dist",
      staticDir: "static"
    }
  },
  server: {
    port: 3000,
    host: 'localhost'
  },
  plugins: [
    '@/plugins/element-plus',
    {
      src: '@/plugins/request',
      mode: 'client'
    }
  ],
  buildModules: [
    'nuxt-vite'
  ],
  proxyTable: {
    // 代理
    "/test": {
      target: "http://192.168.1.114:9501",//测试服务器
      // target: "http://192.168.1.117:9501",//测试服务器
      // target: "http://192.168.x.xxx:8008",//xxx
      changeOrigin: true,
      pathRewrite: {
        "^/test": ""
      }
    },
    "/mock": {
      target: 'http://192.168.1.114:9501',
      // target: "http://192.168.1.117:9501",//测试服务器
      changeOrigin: true,
      pathRewrite: {
        "^/mock": ""
      }
    },
  },
})