tsc --版本2.8.3
在我的firebase项目中,根目录下有tsconfig.json
,如下所示;
{
"compilerOptions": {
/* Basic Options */
"target": "es5",
"module": "commonjs",
"outDir": "./",
"types": ["mocha"],
"sourceMap": true,
"project": "/**/*.ts",
"watch": true,
"strict": true
},
"exclude": ["node_modules", "typings/browser.d.ts", "typings/browser"]
}
在下面的文件夹下,我有如下所示的test.ts
文件;
app-firebase\functions\Repositories\test.ts
代码:
abstract class AnimalAbstract {
abstract makeSound(): void;
move(): void {
console.log("roaming the earth...");
}
}
如果我在根文件夹运行tsc
,它不会将文件编译成.js
。但是如果我导航到文件夹并运行tsc test.ts
,它就会编译。
我还尝试删除config
文件中的project
参数,但也不起作用。
我怎么才能让它watch
整个项目文件夹呢?
发布于 2018-06-03 04:54:52
好的,我必须在配置中添加rootDir
。
{
"compilerOptions": {
/* Basic Options */
"target": "es5",
"module": "commonjs",
"outDir": "./",
"types": ["mocha"],
"sourceMap": true,
"rootDir": "./",
"watch": true,
"strict": true
},
"exclude": ["node_modules", "typings/browser.d.ts", "typings/browser"]
}
https://stackoverflow.com/questions/50660762
复制相似问题