We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
设置如下proxy,供服务访问使用
.webpackrc.js
{ "proxy": { "/atrium": { "target": "http://127.0.0.1:5000/api/v1.0/", "changeOrigin": true, "pathRewrite": { "^/atrium" : "" } }, } }
services中
export function fetch() { return request(`/atrium/commands`); }
npm start,页面加载正常,访问数据工作正常
npm run build后,尝试过使用nginx和http-server分别建立服务器,页面加载正常,但不能访问导数据,控制台打印如下:
GET http://127.0.0.1:8900/atrium/commands 404 (Not Found)
"dva": "^2.1.0"
The text was updated successfully, but these errors were encountered:
自己奋战了几小时,从nginx端进行proxy搞定了。 但还是不是很懂里面的原理,在.webpackrc.js中定义了proxy,run build后就不起作用了么?
Sorry, something went wrong.
npm start 是开发调试,webpackrc文件会生效,方便前后端独立开发,绕过跨域等问题
npm build 生成的文件,webpackrc文件不生效,需要根据各自的产品环境做反向代理
No branches or pull requests
设置如下proxy,供服务访问使用
.webpackrc.js
services中
Expected behavior: (预期的正常效果)
npm start,页面加载正常,访问数据工作正常
Actual behavior: (实际效果)
npm run build后,尝试过使用nginx和http-server分别建立服务器,页面加载正常,但不能访问导数据,控制台打印如下:
Versions of packages used: (哪个库的哪个版本出现的问题)
"dva": "^2.1.0"
The text was updated successfully, but these errors were encountered: