【发布时间】:2018-01-01 03:56:31
【问题描述】:
我有以下package.json 文件:
{
"main": "./dist/index.js",
"scripts": {
"build": "tsc",
"build:live": "tsc && node ./dist/index.js"
},
...
}
如何获取main字段的值,然后将其放入命令node ./dist/index.js,类似这样(只是一个例子,我知道这个$是用于ENV变量的):
{
"main": "./dist/index.js",
"scripts": {
"build": "tsc",
"build:live": "tsc && node $main"
},
...
}
提前致谢
【问题讨论】: