winston import 문제

정민교·2024년 5월 20일
0

trouble shooting

목록 보기
4/5

📒문제

winston 라이브러리 설치 후 winston import를 했는데, winston의 format 프로퍼티를 참조할 때 undefined로 나옴

✔️문제 상황

import winston from 'winston`

default import를 사용하여 winston을 import하고, winstom.format.combine() 메서드를 호출.

이 과정에서 format이 undefined로 참조되었음.

📒해결

import * as winston from 'winston`

namespace import로 해결

👉추가

추가로 tsconfig.jsoncomplierOptions에서 esModuleIteropallowSyntheticDefaultImports 옵션을 활성화하면 defualt import 구문을 사용할 수 있음

추가 정보는 다음 포스팅을 확인
tsconfig.json esModuleInterop, allowSyntheticDefaultImports

profile
백엔드 개발자

0개의 댓글