frontend

[tsconfig] Cannot write file '파일경로/파일명.js' because it would overwrite input file.ts

jhlee_ 2022. 9. 27. 12:19

에러메시지

Cannot write file '파일경로/파일명.js' because it would overwrite input file.ts

해결방법

1. allowJs: true설정을 사용하지 않기
근본적인 해결방법은 아니지만 .js 파일을 사용하지 않을거라면 allowJs: false해서 warning을 없앨수있다. (임시방편) 근본적인 해결방법이 아니기도하고, js 확장자가 필요한 상황이라 다른 방법을 찾아보았다.

2. 👍🏻 outDir를 설정하고 exclude에 포함시키기

{
  compilerOptions: {
      ..., // 생략
    outDir: "dist" // "./" 붙일 필요 없음
  },
  exclude: ["node_modules", "dist"]
}

출처: stockoverflow

728x90