nuxt.config.js 1.6 KB

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