nextjs build error
๐Ÿ› ๏ธ

nextjs build error

Tags
React
Property
Published
May 16, 2021
slug
next-build-error

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*"
        }
    ]
}

Failed to load resource: net::ERR_FAILED

The provided value 'stream' is not a valid enum value of type XMLHttpRequestResponseType.