我在我的项目中使用TypeScript,我可以成功地监视并编译 .ts 文件,并将其输出到 dist
文件夹。
这是我的 package.json
中的 scripts
部分:
"start": "npm run build && npm run watch",
"build": "npm run build-ts && npm run tslint",
"test": "cross-env NODE_ENV=test jest --watch",
"watch": "concurrently -k -p \"[{name}]\" -n \"Typescript,Node\" -c \"cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run serve\"",
"serve": "nodemon dist/server.js",
"build-ts": "tsc",
"watch-ts": "tsc -w",
"tslint": "tslint -c tslint.json -p tsconfig.json"
问题是我想使用JS模板引擎(nunjucks),并且需要监视views文件夹中的视图文件并将它们移动到dist文件夹。
- 是否有一种方法只使用npm脚本或nodejs?
- 还是我需要使用其他工具像gulp或webpack?
graphql
文件的目标添加一个“忽略”配置,以防止无限重启:"ignore": ["./dist/schemas/**/*.graphql"]
。 - tafty