Is it possible to include a json file when using TypeScript with a tsconfig.json file?

前端 未结 3 391
温柔的废话
温柔的废话 2021-01-03 18:45

Is there any way to have the TypeScript compiler also copy content files that don\'t have a ts or tsx extension to the output directory?

For example, my tsconfig.jso

3条回答
  •  一向
    一向 (楼主)
    2021-01-03 18:56

    One workaround is to make the json file a normal js file, require/import it normally, and add "allowJs" : true to "compilerOptions" in tsconfig.json.

提交回复
热议问题