Skip to content

Commit dcb52aa

Browse files
committed
fix: build error due react-router-dom
1 parent 63d502f commit dcb52aa

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

web/package.json

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22
"name": "golang-url-shortener",
33
"version": "0.1.0",
44
"private": true,
5-
"proxy": {
6-
"/api": {
7-
"target": "http://127.0.0.1:8080"
8-
},
9-
"/d": {
10-
"target": "http://127.0.0.1:8080"
11-
}
12-
},
5+
"proxy": "http://127.0.0.1:8080",
136
"dependencies": {
147
"moment": "2.24.0",
158
"prismjs": "1.15.0",
@@ -35,13 +28,13 @@
3528
"test": "react-scripts test --env=jsdom",
3629
"eject": "react-scripts eject"
3730
},
38-
"resolutions": {
39-
"react-router": "4.3.1"
40-
},
4131
"browserslist": [
4232
">0.2%",
4333
"not dead",
4434
"not ie <= 11",
4535
"not op_mini all"
46-
]
36+
],
37+
"devDependencies": {
38+
"http-proxy-middleware": "^0.19.1"
39+
}
4740
}

web/src/setupProxy.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const proxy = require('http-proxy-middleware')
2+
const pkg = require("../package.json")
3+
4+
module.exports = app => {
5+
app.use(proxy('/api', {
6+
target: pkg.proxy
7+
}))
8+
9+
app.use(proxy('/d', {
10+
target: pkg.proxy
11+
}))
12+
}

0 commit comments

Comments
 (0)