我正在运行 ng e2e
。
我希望在 dist/out-tsc-e2e
中看到编译后的 JavaScript;但是,我没有看到这个目录 (out-tsc-e2e
)。
// tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../dist/out-tsc-e2e",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}
我问这个问题的原因是我对运行 ng e2e
时发生的情况感到困惑。
那是编译e2e/
中的 typescript 文件的时候吗?
最佳答案
这似乎是 angular-cli 构建项目的方式。我相信原因是如果您确实在此目录中运行 tsc,这些文件将被转换到 dist/目录。这很棒,因为转译的 JavaScript 文件不会被提交,因为 dist/是 .gitignore
的一部分。
当您运行 ng e2e
时,Protractor 测试不会转译 TypeScript,因为 onPrepare
方法使用 ts-node
来运行 TypeScript,而无需转换为 JavaScript。
关于angular - 运行 ng e2e 时 dist/out-tsc-e2e 在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42030537/