I followed the answer here
Separate Angular2 TypeScript files and JavaScript files into different folders, maybe 'dist‘
in order to separate my files into app
and dist
folders. The interesting thing is that when I create a new .ts
file somewhere in the app
folder ir creates a .js
and .js.map
files automatically in the dist
folder, but when I delete a .ts
file from the app
folder the corresponfing .js
and .js.map
files from the dist
folder are not deleted. Why is that and how can I fix it ?
package.json
{
"name": "angular-quickstart",
"version": "1.0.0",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"tsc": "tsc",
"tsc:w": "tsc -w"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/angular/angular.io/blob/master/LICENSE"
}
],
"dependencies": {
"@angular/common": "2.3.0",
"@angular/compiler": "2.3.0",
"@angular/core": "2.3.0",
"@angular/forms": "2.3.0",
"@angular/http": "2.3.0",
"@angular/platform-browser": "2.3.0",
"@angular/platform-browser-dynamic": "2.3.0",
"@angular/router": "3.3.0",
"@angular/upgrade": "2.3.0",
"angular-in-memory-web-api": "0.2.0",
"core-js": "2.4.1",
"primeng": "1.0.0",
"querystring": "0.2.0",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.0-rc.4",
"systemjs": "0.19.39",
"zone.js": "0.7.2"
},
"devDependencies": {
"@types/core-js": "0.9.34",
"@types/node": "6.0.45",
"concurrently": "3.0.0",
"lite-server": "2.2.2",
"typescript": "2.1.4"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"inlineSourceMap": false,
"inlineSources": false,
"outDir" : "dist"
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
],
"compileOnSave": true
}
systemjs.config.js
/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'dist',
// our app modules
'domain' : 'app/domain',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'primeng': 'npm:primeng'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
// for our app modules
domain : {
main: 'index.js', defaultExtension: 'js'
},
// other libraries
rxjs: {
defaultExtension: 'js'
},
primeng: {
defaultExtension: 'js'
}
}
});
})(this);