더 큰 프로젝트에서 하나의 typescript 파일을 다른 파일 확장자로 컴파일하는 방법은 무엇입니까?

벌레 자석

여기 내 tsconfig.json이 있습니다.

{
  "compileOnSave": true,
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "target": "ES3",
    "lib": ["ESNext"],
    "strict": false,
    "moduleResolution": "node",
    "module": "commonjs",
    "types": ["d.ts"],
    "removeComments": true
  },
  "include": ["*.ts"]
}

내 프로젝트에는 여러 .ts 파일과 d.ts/index.d.ts.

내 프로젝트의 .ts 파일 중 하나만 컴파일하여 .rr확장자 가있는 파일로 출력하고 싶습니다 .

--outFile작동하지만 모든 설정이 tsconfig.json적용 되도록 CLI가 무엇을 말해야하는지 알 수 없습니다 . 현재 나는TS2304: Cannot find name 'blah'

시밤 판 데이

outFile아래 구성으로 작업하고 있습니다. 또는 모듈에서만 outFile사용할 수 있습니다 . 에 대한 문제에 직면 한 구성을 시도했습니다 . 제거하면 모든 것이 예상대로 작동합니다.amdsystemlib

{
    "compilerOptions": {
        "target": "es5",
        "module": "system",
        "outFile": "./output/test.rr",
        "rootDir": "./",
        "strict": true,
        "esModuleInterop": true,
        "skipLibCheck": true
    },
    "include": [
        "./testfile.ts"
    ]
}

변경, 모듈 및 lib 및 유형 제거 후 구성,

{
    "compileOnSave": true,
    "compilerOptions": {
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "outFile": "./output/testfile11.rr",
        "target": "ES3",
        "strict": false,
        "moduleResolution": "node",
        "module": "system",
        "removeComments": true
    },
    "include": [
        "testfile.ts"
    ]
}

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관