I keep getting the following error:
Error Code: TS5055
Cannot write file C:/project/dir/server.js' because it would overwrite input file.
Project: TypeScript/JavaScript Virtual Projects
I even tried changing my entry filename to nodeserver.js
and after a while I get the same error:
Error Code: TS5055
Cannot write file C:/project/dir/nodeserver.js' because it would overwrite input file.
Project: TypeScript/JavaScript Virtual Projects
How can I find out what component is trying to overwrite it?
I did notice the file has the BuildAction
set to Compile
and 'Publish' to true. Could this be the cause? What is the implication of turning off Compile
for a .js file? Will I not get any error checking?
My 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"
]
}
My 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": "[email protected]"
},
"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"
}
]
}
}
It seems that typescript compiler tries to transpile everything, including files that are already javascript. The solution is to add a new field outDir, to the compilerOptions, so it looks like this:
{
...
"compilerOptions": {
...
"outDir": "generated"
}
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With