【发布时间】:2018-08-06 05:27:39
【问题描述】:
当我运行 nodemon dist/index.js 时,nodemon 运行服务器,但如果我使用 nodemon -w dist/index.js,它只会继续启动,而不会实际运行我的服务器。
我从 Typescript 转译了我的 index.js 文件,它看起来像这样:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const App_1 = require("./App");
const port = process.env.PORT || 3000;
App_1.default.listen(port, (err) => {
if (err) {
return console.log(err);
}
return console.log(`server is listening on ${port}`);
});
//# sourceMappingURL=index.js.map
据我所知,.js 文件在我使用 tsc -b 命令从 typescript 转换后不再更改。
什么可能导致 nodemon 继续启动?我该如何解决?
【问题讨论】:
-
你为什么使用-w?
-
我想使用 nodemon 和 tsc 构建一个开发脚本,当我在运行服务器时更改我的 typescript 时,它会自动转译为 node.js,然后 nodemon 也会接收更改。跨度>
标签: javascript typescript nodemon