Some of the answers from StackOverflow suggests using .gitignore to hide the said files. Unfortunately, my limited knowledge and patience can't get the suggestion to work.
Another option I stumbled upon was to use outDir from the compilerOptions. The outDir option saves the transpiled code to a specified directory. I was able to successfully move the .map and .js files to the build directory using the tsconfig.json setting below:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "build"
}
}
I'm testing using the Angular 2 QuickStart files from the link below: https://angular.io/docs/ts/latest/quickstart.html
The option for the outDir I've used above broke the code. Digging for answers I've finally got them to work. So to use outDir for the 5 minute QuickStart files, we have to modify both tsconfig.json and index.html to like the code below:
tsconfig.js
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "build/app"
}
}
index.html
<html>
<head>
<title>Angular 2 QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('build/app').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
Now I can continue my Angular 2 TypeScript adventure without being distracted by unwanted files from my IDE of choice.
If this post helped you solve the same issue as I have, please let me know by posting a comment below.
Now back to coding...