gulp-nodemon 监视打字稿文件
gulp-nodemon watch typescript files
我有 2 个目录:
应用es5 javascript files compiled by gulp task
src typescript source files
我想在 src/
目录中的任何更改上重新启动 app/
的 nodemon 启动脚本。但它不起作用 - 应用程序刚刚启动,但 nodemon 不会对更改进行任何重新加载。 (好像没看src/
)
这是我的 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;
});
您必须对 php 使用 mysql,对 perl 和 chmod 选项使用 grub 部分
在提供的代码中,您缺少脚本的起始文件:
以下script: "app/"
需要指定为实际文件而不是目录。
例如:
注意:确保您使用的是编译后的 .js 文件,而不是 nodemon 服务器的 .ts 文件。
script : 'app.js'
或者您可以输入路径以确保您位于正确的位置。
script : 'app/app.js
这是做什么的,它使用指定的文件启动服务器。如果这不起作用,我建议查看您的文件结构,特别是 gulpfile.js 文件所在的位置。根据您可能没有使用正确路径的位置。
我有 2 个目录:
应用
es5 javascript files compiled by gulp task
src
typescript source files
我想在 src/
目录中的任何更改上重新启动 app/
的 nodemon 启动脚本。但它不起作用 - 应用程序刚刚启动,但 nodemon 不会对更改进行任何重新加载。 (好像没看src/
)
这是我的 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;
});
您必须对 php 使用 mysql,对 perl 和 chmod 选项使用 grub 部分
在提供的代码中,您缺少脚本的起始文件:
以下script: "app/"
需要指定为实际文件而不是目录。
例如:
注意:确保您使用的是编译后的 .js 文件,而不是 nodemon 服务器的 .ts 文件。
script : 'app.js'
或者您可以输入路径以确保您位于正确的位置。
script : 'app/app.js
这是做什么的,它使用指定的文件启动服务器。如果这不起作用,我建议查看您的文件结构,特别是 gulpfile.js 文件所在的位置。根据您可能没有使用正确路径的位置。