본문 바로가기
공부/Web

Web - "Assign object to a variable before exporting as module default import/no-anonymous-default-export"에러 해결하는 법

by hhhello 2024. 7. 2.

이번 포스팅에서는 "Assign object to a variable before exporting as module default import/no-anonymous-default-export"에러를 해결하는 방법을 알려드리겠습니다.

아래와 같이 AuthAPI클래스를 생성해서 export해주고 있는데

export default new AuthAPI();

 

아래와 같이 const변수에 저장한 뒤 export하면 해결됩니다.
Object타입일 경우도 마찬가지 입니다.

const authApi = new AuthAPI();

export default authApi;