- Change the
outDir
entry of your tsconfig.json
file. This is conventionally called build
but you can name it whatever you'd like.
// tsconfig.json (mine is in the root directory of my project)
{
"compilerOptions": {
...
"outDir": "myAwesomeSuperCoolBuildDirectoryThatIPromiseToChangeAndNotJustCopyBlindlyFromStackOverflowBecauseThatWouldBeBad",
"sourceMap": true,
...
}
}
- Add
outDir
followed by a forward slash --> /
to your .gitignore
file
// .gitignore (mine is in the root directory of my project)
myAwesomeSuperCoolBuildDirectoryThatIPromiseToChangeAndNotJustCopyBlindlyFromStackOverflowBecauseThatWouldBeBad/
- Delete old
js.map
and js
files generated by TypeScript and build them again. This time, they will be built in the specified directory and will be ignored by git.