This commit is contained in:
2022-08-14 13:42:24 +08:00
parent ccc57ec252
commit ecebb6b1d8
16 changed files with 18354 additions and 2419 deletions
+2
View File
@@ -0,0 +1,2 @@
方法1
修改package.json "proxy": "http://m.kugo.com"
+2
View File
@@ -0,0 +1,2 @@
方法2
修改package.json
+11
View File
@@ -0,0 +1,11 @@
方法3
npm run eject
config/webpackDevServer.config
"proxy":{
"/api":{
"target":"http://m.kugo.com",
"changeOrigin": true,//默认false,是否需要改变原始主机头为目标URL
"pathRewrite": {"^/api" : " "},// 重写请求,比如我们源访问的是api,那么请求会被解析为/
"secure": false, //如果是https接口 需要配置这个参数为true
}
},
+18281 -2393
View File
File diff suppressed because it is too large Load Diff
+8 -6
View File
@@ -3,13 +3,12 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.26.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "5.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
@@ -35,5 +34,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"http-proxy-middleware": "^2.0.6"
}
}
-1
View File
@@ -1 +0,0 @@
setupProxy.js未能再现
+4 -4
View File
@@ -1,14 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function