前端代理的问题
#12613
Replies: 3 comments 1 reply
-
解决了,这样就可以了 server:{
proxy:{
'/server':{
target: 'http://43.142.78.228:3000/',
changeOrigin: true,
rewrite: path=> path.replace(/^\/server/,'')
}
}
} 但是不是很理解为什么对应的匿名函数是单句就可以,如果用大括号括起来就会报错QAQ |
Beta Was this translation helpful? Give feedback.
0 replies
-
好吧是需要一个返回值的,大括号不给返回值所以不可以捏,是我JS语法有问题QAQ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
目前的前端代理是这样的:
只要出现rewrite属性,程序就一定会报错,而且是会导致整个vite应用退出的错误
在Stack Overflow上搜了一圈发现react会有类似的问题,但是vue上的情况好像没有,不知道应该如何解决QAQ
Beta Was this translation helpful? Give feedback.
All reactions