How to configure tsconfig.json to output files from multiple source folders to single flat outDir?

后端 未结 3 785
青春惊慌失措
青春惊慌失措 2021-01-15 11:20

I have multiple typescript projects (e.g. client and server), which share some common functionality (located in a common fold

3条回答
  •  深忆病人
    2021-01-15 12:14

    I've solved this problem in my current project (which has the same setup) by putting a link to the common lib into both sources.

    common/
      src/
        lib/
    client/
      src/
        lib/ -> $PROJECT_PATH/common/src/lib/
    server/
      src/
        lib/ -> $PROJECT_PATH/common/src/lib/
    

    Compilation and bundling become transparent as the tools treat that directory as a local one.

提交回复
热议问题