문제 상황
회사 일로 react-sortable-tree를 쓰는데, 'Cannot have two HTML5 backends at the same time.'라는 에러가 떴음
문제는 말 내가 한 페이지 내에서 두개 이상의 SortableTree를 사용하기 때문이었음
https://github.com/frontend-collective/react-sortable-tree/issues/177
해결 시도
찾아보니, SortableTreeWithoutDndContext를 쓰고, dnd를 내 컴포넌트에서 주입해주면 된다고 함.
https://github.com/frontend-collective/react-sortable-tree/issues/511
그렇게 했지만, 렌더는 잘됐던게 아무것도 안뜸. 서치를 더 해보니 밖에서 주입해야하는 dnd가 적용이 안되서 그럼. 분명 안될리가 없는데 안됐음
해결
이슈를 계속 뒤적여보니, react-dnd가 내 package와 sortableTree 두 군데서 따로 load되어 사용되기 때문이라는 코멘트가 보였음
https://github.com/frontend-collective/react-sortable-tree/issues/665
그래서 npm dedupe --legacy-peer-deps를 적용하니 문제가 해결됨!!
npm dedupe
여러 패키지에서 공통으로 사용하는 패키지를 정리해줌
https://outofbedlam.gitbooks.io/npm-handbook/content/cli/npm-dedupe.html
'TIL(Today I Learned) > 2022년' 카테고리의 다른 글
04.09 - 유튜브 영상 controller처럼 3초후 show / hide 구현 (0) | 2022.04.10 |
---|---|
03.22 - Next.js > window 등 client 객체 사용 / tailwind css의 mobile first (0) | 2022.03.23 |
02.21 - 자바 챔피언 양수열님의 조언 (0) | 2022.02.22 |
02.14 - input에서 한 글자 입력 후 focus를 잃는 현상 / string으로 js object 값에 접근하기 (0) | 2022.02.16 |
01.25 - 브라우져별 지원하는 동영상 format이 다를 수 있다 (0) | 2022.01.25 |