개발이야기
Duplicate atom key 에러 메시지 없애기 (Next.js)
mayoDev
2023. 2. 26. 20:46
https://recoiljs.org/blog/2022/10/11/recoil-0.7.6-release/
Recoil 0.7.6 | Recoil
- Expose flag to disable "duplicate atom key" checking / logging, as it was too noisy in environments such as NextJS or some dev environments using Fast Refresh. (#733, #2020, #2046)
recoiljs.org
위는 해당 오류 공식 문서 내용이다.
next.js에서 recoil을 쓰다보면 만나는 고질적인 문제.
Duplicate atom key "". This is a FATAL ERROR in production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
엄청나게 많이 에러가 나와서 무시할 수 없는 상태였다. console.log를 확인할 수 없는 지경 ..
공식 문서 해결법대로 따라하니깐 메세지가 더이상 나오지 않았다.
1.RecoilEnv 임포트
2. 오류나는 파일에서 다음 문구 추가
RecoilEnv.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED = false;
문제가 깔끔하게 해결된다.