How do I compile Typescript at Heroku postinstall?

前端 未结 2 1461
故里飘歌
故里飘歌 2021-02-19 19:20

Instead of uploading the precompiled dist directory, I want to compile src at server side instead.

Here are my scripts inside package.json:

\"scripts\":          


        
2条回答
  •  鱼传尺愫
    2021-02-19 19:36

    You need to call tsc from an npm script. Otherwise Heroku tries to find a global dependency named tsc.

    Create a new npm script in your package.json:

    "tsc": "tsc"
    

    now replace "postinstall": "tsc" with:

    "postinstall": "npm run tsc"
    

提交回复
热议问题