nuxt.config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. export default defineNuxtConfig({
  2. //taget: "static",
  3. ssr: true,
  4. app: {
  5. head: {
  6. title: '三农资讯网',
  7. meta: [
  8. { name: 'description', content: '三农资讯网' },
  9. { name: 'keywords', content: '三农资讯网' },
  10. ],
  11. },
  12. },
  13. compatibilityDate: '2025-02-28',
  14. devtools: { enabled: true },
  15. module: [
  16. '@nuxtjs/style-resources',
  17. '@element-plus/nuxt',
  18. "@gauseen/nuxt-proxy",
  19. '@pinia/nuxt',
  20. ],
  21. css: [
  22. '~/assets/css/global.css',
  23. '~/assets/css/font.css',
  24. 'element-plus/dist/index.css',
  25. 'element-plus/theme-chalk/display.css'
  26. ],
  27. // router: {
  28. // // middleware: ['auth']
  29. // mode: 'hash',
  30. // },
  31. router: {
  32. extendRoutes(routes, resolve) {
  33. const targetPageRoute = routes.find(route => route.path === '/target - page');
  34. if (targetPageRoute) {
  35. targetPageRoute.meta = targetPageRoute.meta || {};
  36. targetPageRoute.meta.noCache = true;
  37. }
  38. }
  39. },
  40. build: {
  41. publicPath: '/'
  42. },
  43. nitro: {
  44. output: {
  45. publicDir: "dist",
  46. staticDir: "static"
  47. }
  48. },
  49. server: {
  50. port: 3000,
  51. host: 'localhost'
  52. },
  53. plugins: [
  54. '@/plugins/element-plus',
  55. {
  56. src: '@/plugins/request',
  57. mode: 'client'
  58. }
  59. ],
  60. buildModules: [
  61. 'nuxt-vite'
  62. ],
  63. proxyTable: {
  64. // 代理
  65. "/test": {
  66. target: "http://192.168.1.114:9501",//测试服务器
  67. // target: "http://192.168.1.117:9501",//测试服务器
  68. // target: "http://192.168.x.xxx:8008",//xxx
  69. changeOrigin: true,
  70. pathRewrite: {
  71. "^/test": ""
  72. }
  73. },
  74. "/mock": {
  75. target: 'http://192.168.1.114:9501',
  76. // target: "http://192.168.1.117:9501",//测试服务器
  77. changeOrigin: true,
  78. pathRewrite: {
  79. "^/mock": ""
  80. }
  81. },
  82. }
  83. })