개발/react
typescript. ??(nullish-coalescing) unexpected token, you may need an appropriate loader to handle this file type
ttoance
2023. 8. 6. 07:00
반응형
문제 상황 >
- npm start 시 unexpected token 발생
- 노마드코더 강의 듣는 중 발생 https://nomadcoders.co/react-masterclass
/src/Circle.tsx 21:30
Module parse failed: Unexpected token (21:30)
You may need an appropriate loader to handle this file type.
| return /*#__PURE__*/React.createElement(Container, {
| bgColor: bgColor,
> borderColor: borderColor ?? bgColor,
| __self: this,
| __source: {
해결 >
- react 버전 18 -> 17로 다운그레이드 하니까 해결됨
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.5.3",
"@types/node": "^20.4.5",
"@types/react": "^18.2.17",
"@types/react-dom": "^18.2.7",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"styled-components": "^6.0.5",
"typescript": "^5.1.6",
"web-vitals": "^2.1.4"
},
https://stackoverflow.com/questions/71938980/typescript-cant-understand-nullish-coalescing
Typescript can't understand nullish-coalescing
I'm using an external package (@moj/pagination-layout) inside Vue + TypeScript app, this package uses nullish operator inside of it but when I try to run build it fails and give me this error ERR...
stackoverflow.com
반응형