CRA ๋น๋์ tsconfig jsx ์ค๋ฅ
vscode์์ ๋น๋์
tsconfig.json
์ react-jsx
๊ฐ ์๋์ผ๋ก ์์ ๋๋ค.vercel์์๋ -jsx ์์ด react์ฌ์ผ ๋ฐฐํฌ๊ฐ ์ฑ๊ณตํ๋ค.
ย
๋น๋์
jsx:"react-jsx
๋ก ์๋์ผ๋ก ๋ถ์ผ๋ฉด์ ๋น๋๋ ๋์ง๋ง ์ด๋ฐ ๊ฒฝ๊ณ ๊ฐ ๋์จ๋ค.The following changes are being made to your tsconfig.json file:
- compilerOptions.jsx must be react-jsx (to support the new JSX transform in React 17)
ย
์๋ ์์ ์๋๋๋ก env ์ค์ ํ๋ ๋ฐฉ๋ฒ
.env
DISABLE_NEW_JSX_TRANSFORM=true
ย
์ด์ ๋ tsconfig๊ฐ ์๋์ผ๋ก ๋ฐ๋์ง ์์ง๋ง ๋น๋์ ๋ค์ ์๋ก์ด ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉฐ ๋น๋์ ์คํจํ๋ค.
Line 123:10: 'React' must be in scope when using JSX react/react-in-jsx-scope
vercel deploy error
ย
Error: <circle> attribute r: Expected length, "NaN".
- parent์ ์ฌ์ด์ฆ ๋๋ฌธ์ ์ผ์ด๋๋ ์ด์๋ผ๊ณ ํ๋ค.
- ๋์ด๋ฅผ ๋ทฐํฌํธ 100vw๋ก ์คฌ๋๊ฑธ ๊ณ ์ px๋ก ์์ โ ๋๊ฐ์ด ๋ฐ์ํ๋ค.
๋ถ๋ชจ ํ๊ทธ์ ์ธ๋ผ์ธ์ผ๋ก ๋์ด ์ง์
<div className="canvas" style={{ height: 500 }}>
- Because of the known issues like "infinitely growing diagrams" I almost always use the AutoSizer wrapper in favour of the <Responsive*> components.
AutoSizer ๋ชจ๋ ์ ์ฉ, Bubble๋ก ๋ณ๊ฒฝ
๊ทธ๋๋ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค.
ํด๊ฒฐ : ๋ฒ์ ์ 67 โ 69
"@nivo/circle-packing": "^0.69.0",
"@nivo/core": "^0.69.0",
import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';
<AutoSizer style={{ width:'100%' }}>
{({ height, width }) => (
<Pie
height={height}
width={width}
...
/>
)}
</AutoSizer>```
API Proxy & CORS in vercel
- netlifty ์์๋ _redirect
- vercel?
์๋ฌ๋ ์๋๋๋ฐ ํ์ด์ง๊ฐ ์๋ณด์ด๋ ํ์์ด ์๋ค.
ย
pages/api/proxy/
๊ฒฝ๋ก๋ก..src/pages/api/proxy/setupProxy.js
์ฌ์ ์ฉ
rewrite
root ๋๋ ํ ๋ฆฌ์ vercel.json
src๋ ๊ฐ์ ๋์ค
/:match*
{
"source": "/stock/sise/:match*",
"destination": "http://www.paxnet.co.kr/stock/sise/:match*"
},
{
"rewrites": [
{
"source": "/v2/providers/:match*",
"destination": "https://api-gateway.coupang.com/v2/providers/:match*"
},
{
"source": "/price/:match*",
"destination": "http://m.coin.zum.com/price/:match*"
},
{
"source": "/v1/:match*",
"destination": "https://openapi.naver.com/v1/:match*"
},
{
"source": "/v2/search/:match*",
"destination": "https://dapi.kakao.com/v2/search/:match*"
},
{
"source": "/openapi/:match*",
"destination": "http://openapi.data.go.kr/openapi/:match*"
},
{
"source": "/song/:match*",
"destination": "http://ncov.mohw.go.kr/:match*"
},
{
"source": "/znews/:match*",
"destination": "https://news.zum.com/:match*"
},
{
"source": "/zissue/:match*",
"destination": "https://issue.zum.com/:match*"
},
{
"source": "/ncv/:match*",
"destination": "https://ncv.kdca.go.kr/:match*"
},
{
"source": "/backsin/:match*",
"destination": "https://ncv.kdca.go.kr/:match*"
}
]
}