[英]gulp-nodemon watch typescript files
I have 2 directories: 我有2个目录:
app es5 javascript files compiled by gulp task
es5 javascript files compiled by gulp task
app es5 javascript files compiled by gulp task
src typescript source files
src
typescript source files
I want to nodemon make start script from app/
restart on any changes in src/
dir. 我想通过
src/
dir中的任何更改从app/
重新启动启动脚本。 But it doesn't work - App just started, but nodemon doesn't make any reloads on changes. 但这不起作用-应用程序刚刚启动,但是nodemon不会对更改进行任何重新加载。 (Looks like he doesn't watch
src/
) (看起来他不看
src/
)
This is my gulpfile
: 这是我的
gulpfile
:
var gulp = require("gulp-help")(require("gulp")),
ts = require("gulp-typescript"),
nodemon = require("gulp-nodemon");
/***********************************************************************************
* Build es5 javascript files from typescript sources
***********************************************************************************/
gulp.task("compile", function() {
var project = ts.createProject({
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": true,
"noImplicitAny": false
});
return gulp.src("./src/**/*.ts")
.pipe(project())
.pipe(gulp.dest("./app/"))
});
/***********************************************************************************
* Call "build" task and start nodemon with watch (autorestart on changes found)
***********************************************************************************/
gulp.task("default", ["compile"], function() {
var stream = nodemon({
script: "app/",
watch: "src",
tasks: ["compile"],
env: { "DEBUG": "Application,Request,Response" }
});
return stream;
});
In the provided code you are missing the starting file for script: 在提供的代码中,您缺少脚本的起始文件:
The Following script: "app/"
needs to be specified to an actual file not a directory. 以下
script: "app/"
需要指定到实际文件而不是目录。
For example : 例如 :
Note: make sure you are using the compiled .js file and not a .ts file for the nodemon server. 注意:确保为nodemon服务器使用的是已编译的.js文件,而不是.ts文件。
script : 'app.js'
or you can put a path to make sure you are in the correct location. 或者您可以放置一条路径以确保您位于正确的位置。
script : 'app/app.js
What this does it starts the server using the specified file. 这将使用指定的文件启动服务器。 If this does not work I recommend looking at your file structure, in specific where the gulpfile.js file is located.
如果这样做不起作用,建议您查看您的文件结构,特别是gulpfile.js文件所在的位置。 Depending on the location you might not be using the correct path.
根据位置,您可能未使用正确的路径。
您必须使用mysql作为php和grub部分的perl和chmod选项
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.