![](/img/trans.png)
[英]How to enable intellisense for nodejs in visual studio 2015?
[英]Visual Studio 2015 NodeJS/Typescript overwriting node startup file
我一直收到以下错误:
Error Code: TS5055
Cannot write file C:/project/dir/server.js' because it would overwrite input file.
Project: TypeScript/JavaScript Virtual Projects
我甚至尝试将我的条目文件名更改为nodeserver.js
,过了一会儿我得到了同样的错误:
Error Code: TS5055
Cannot write file C:/project/dir/nodeserver.js' because it would overwrite input file.
Project: TypeScript/JavaScript Virtual Projects
如何找出试图覆盖它的组件?
我注意到该文件将BuildAction
设置为Compile
并将'Publish'设置为true。 这可能是原因吗? 关闭.js文件的Compile
有什么意义? 我不会得到任何错误检查吗?
我的tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"isolatedModules": false,
"jsx": "react"
},
"exclude": [
"node_modules",
"public",
"server.js",
"Scripts/typings/main",
"Scripts/typings/main.d.ts"
],
"filesGlob": [
"./src/**/*.ts",
"./src/**/*.tsx"
]
}
我的package.json
{
"name": "contract-vs-paye-calc-type-script",
"version": "0.0.0",
"description": "ContractVsPayeCalcTypeScript",
"scripts": {
"start": "node nodeserver.js",
"lint": "eslint src"
},
"main": "/src/App.js",
"author": {
"name": "MC",
"email": "admin@admin.com"
},
"dependencies": {
"babel-core": "^6.7.7",
"babel-loader": "^6.2.4",
"express": "3.4.4",
"jade": "*",
"react": "^15.0.1",
"react-dom": "^15.0.1",
"react-hot-loader": "^1.3.0",
"stylus": "*",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1"
},
"module": {
"loaders": [
{
"test": "/\\.ts(x?)$/",
"loader": "babel-loader!ts-loader"
}
]
}
}
似乎typescript编译器试图转换所有内容,包括已经是javascript的文件。 解决方案是将新字段outDir添加到compilerOptions,所以它看起来像这样:
{
...
"compilerOptions": {
...
"outDir": "generated"
}
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.