I recently integrated the TypeScript.MSBuild NuGet package into two different projects.
(Just tested it with version 2.7.2.)
Locally, everything runs smoothly. On Kudu, the build process is successful as well. However, on travis-ci and Bitbucket's pipelines, I encounter the following error for each .ts file:
CompileTypeScriptWithTSConfig:
/home/travis/.nvm/versions/node/v6.12.0/bin/node /home/travis/build/<user>/<project>/packages/Microsoft.TypeScript.MSBuild.2.7.2/tools/tsc/tsc.js --project "/home/travis/build/<user>/<project>/Scripts/TypeScript/tsconfig.json" --listEmittedFiles
/home/travis/build/<user>/<project>/packages/Microsoft.TypeScript.MSBuild.2.7.2/tools/Microsoft.TypeScript.targets(444,5): error : Failed to create URI from '\home\travis\build\<user>\<project>\Scripts\TypeScript\App.js'. [/home/travis/build/<user>/<project>/<project>.csproj]
/home/travis/build/<user>/<project>/packages/Microsoft.TypeScript.MSBuild.2.7.2/tools/Microsoft.TypeScript.targets(444,5): error : Failed to create URI from '\home\travis\build\<user>\<project>\Scripts\TypeScript\App.js.map'. [/home/travis/build/<user>/<project>/<project>.csproj]
The contents of my tsconfig.json
file are as follows:
{
"compilerOptions": {
"noImplicitAny": true,
"noImplicitThis": true,
"noEmitOnError": true,
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"removeComments": true
},
"compileOnSave": true
}
Furthermore, running the command locally provides the expected results: (I even tried executing nvm use 6.12.0
to rule out any potential node issues)
C:\Users\User\Projects\Project> node ./packages/Microsoft.TypeScript.MSBuild.2.7.2/tools/tsc/tsc.js --project "<Project>/Scripts/TypeScript/tsconfig.json" --listEmittedFiles
TSFILE: C:/Users/User/Projects/Project/Scripts/TypeScript/App.js
TSFILE: C:/Users/User/Projects/Project/Scripts/TypeScript/App.js.map
Hence, my query is: How can I effectively utilize the TypeScript.MSBuild NuGet package in conjunction with my ci?
EDIT: Upon connecting to the travis container via ssh, I attempted the msbuild command twice. Surprisingly, it successfully compiled on the second attempt. It appears that the MSBuild task may be attempting to build a URI prematurely, perhaps?