我按照这里的答案
Separate Angular2 TypeScript files and JavaScript files into different folders, maybe 'dist‘
为了将我的文件分成app
和dist
个文件夹。有趣的是,当我在.ts
文件夹中的某个位置创建新的app
文件时,会在.js
文件夹中自动创建.js.map
和dist
个文件,但是当我从.ts
文件夹中删除app
文件时,.js
文件夹中的相应.js.map
和dist
文件不会被删除。为什么这样,我该如何解决?
的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);