tsconfig - How to set correct compiler output location for multiple directories (Atom)

后端 未结 2 486
生来不讨喜
生来不讨喜 2021-01-03 18:42

Suppose I have this directory structure:

public/
    js/
        lib/
test/
    ts/
lib/
    ts/

How would I configure it to compile

2条回答
  •  独厮守ぢ
    2021-01-03 18:50

    I ended up getting what I wanted with this layout:

    public/
        js/
            lib/
            test/
    src/
        ts/
            lib/
            test/
    

    In src/ts/test/tsconfig.json:

    "outDir": "../../../public/js"
    

    In src/ts/lib/tsconfig.json:

    "outDir": "../../../public/js/lib"
    

    In src/ts/test/test.ts:

    /// 
    

    In Atom, if you're working in src/ts/lib, building will compile those files into public/js/lib.

    If you're working in src/ts/test, the build will compile *.ts in test - as well as all files referenced. I don't see a way to prevent referenced file compilation, but at least with this layout they go to the same location.

提交回复
热议问题