winodw 사용중
현재상황: nestjs로 도커 컴포즈 postgresql 연결후,
npm run start:dev로 실행
문제발생: ReferenceError: exports is not defined in ESReferenceError: exports is not defined in ES module scope module scope 에러발생
내가해본 해결책들
1. package.json에 "type":"module" 추가해보기
2. tsconfig.json에 "target": "es6" 수정해서 해보기 (기존에는 "target": "ES2021" 이렇게 되어 있었음)
3. tsconfig.json에서
"module": "commonjs",
Object.defineProperty(exports, "__esModule", { value: true }) 지워보기
4. main.ts를 main.cjs로 바꿔보기
5. 왜안되는걸까요ㅜㅜ
해결:
typeormconfig에있는
ENTITIES: [__dirname + '/../entities/*{.ts,.js}']
이걸
ENTITIES: [UserEntity],
이렇게 해주면됩니다
다음 내용이 궁금하다면?
이미 회원이신가요?
2024년 2월 7일 오전 12:44