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

后端 未结 2 474
生来不讨喜
生来不讨喜 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 19:02

    How would I configure it to compile lib/ts/.ts to public/js/lib/.js and test/ts/.ts to public/js/.js?

    If you want to compile test and public in a single compilation context then effectively your ts tree is :

    test/
        ts/
    lib/
        ts/
    

    Therefore if you use an outDir of ./public/js you will get:

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

    This is because the relative nature of lib/ts to test/ts needs to be preserved by outDir. This is a limation in how you are trying to organize your project.

    Reorganize your project as

    ts/
        test/
        lib/
    

提交回复
热议问题