nuxt.config.js 1.6 KB

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