How to run typescript compiler as a package.json script without grunt or gulp

后端 未结 2 1219
孤独总比滥情好
孤独总比滥情好 2020-12-29 01:59

I don\'t want to use grunt or gulp to compile ts files. I just want to do it in my package.json something like this:

  \"scripts\": {
    \"build\": \"tsc ma         


        
2条回答
  •  -上瘾入骨i
    2020-12-29 02:35

    If you want to compile and run, you can use the ts-node module.

    npm install --save-dev ts-node 
    npm install --save-dev typescript
    

    And run with:

    "scripts": {
        "start": "ts-node index.ts"
    },
    

    All other typescripts files that index.ts has imported (along with imports from index.ts dependencies) will be compiled and executed.

提交回复
热议问题