Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 빌드 후, tsconfig paths 경로 매핑 오류 수정 #3

Merged
merged 1 commit into from
Sep 1, 2022

Conversation

eenaree
Copy link
Owner

@eenaree eenaree commented Sep 1, 2022

What is this PR?

tsconfig paths 매핑 경로 버그 수정

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Changes

tsconfig-paths 옵션 명령어를 이용해 매핑 경로에 해당하는 모듈을 가져오도록 함.

Screenshot

기능 스크린샷
로컬 실행 테스트 제목 없음

Test Checklist

  • 빌드 후, 로컬 환경에서 npm run start 실행하여 resolve 에러 없음 확인

Etc

tsconfig-paths 패키지 공식 문서에서 node 환경에서도 옵션 명령어 실행이 가능하다고 되어있는데,
node를 사용할 경우엔, 여전히 매핑 경로 모듈을 인식하지 못하는 문제가 발생함.

관련된 이슈 몇가지를 찾긴 했는데, ts-node를 사용한 것보다 방법이 복잡하고 제대로 적용이 되는지도 확인이 안됨.

resolve #2

tsc를 실행해도 tsconfig.json에서 매핑한 경로가 변경되지 않음.
이 상태에서 node 환경에서 모듈을 가져오려고 하면,
node_modules에서만 해당 모듈을 찾기 때문에 에러가 발생함.

개발 모드에서 실행했던 tsconfig-paths 옵션 명령어를
프로덕션 모드에서도 실행하여 매핑 경로가 제대로 설정될 수 있도록,
node 대신 ts-node 사용.

- transpile-only 옵션 추가
tsc에서 타입 체크를 한 후, 빌드한 파일을 실행하므로 트랜스파일만 함.
@eenaree eenaree self-assigned this Sep 1, 2022
@eenaree eenaree changed the title Fix: tsconfig #2 Fix: 빌드 후, tsconfig paths 경로 매핑 오류 수정 #2 Sep 1, 2022
@eenaree eenaree changed the title Fix: 빌드 후, tsconfig paths 경로 매핑 오류 수정 #2 Fix: 빌드 후, tsconfig paths 경로 매핑 오류 수정 Sep 1, 2022
@eenaree eenaree merged commit bade849 into develop Sep 1, 2022
@eenaree eenaree deleted the 2-tsconfigPaths branch September 1, 2022 04:36
@eenaree eenaree added the bug Something isn't working label Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] 컴파일 시, tsconfig paths 매핑 경로 인식 안되는 문제
1 participant