我有angular2-webpack-starter。
.
├── src
│ ├── auth
│ │ ├── app
│ │ │ ├── app.component.html
│ │ │ ├── app.component.scss
│ │ │ ├── app.component.ts
│ │ │ └── app.module.ts
│ │ ├── main.ts
│ │ ├── polyfills.ts
│ │ └── vendor.ts
├── node_modules
├── tsconfig.json
├── tslint.json
├── typedoc.json
└── webpack.config.js
当我使用
时$ ngc -p tsonfig.json
.
├── compiled
└── source
│ └── auth
│ ├── app
│ │ ├── app.component.ngfactory.js
│ │ ├── app.component.ngfactory.js.map
│ │ ├── app.component.ngfactory.ts
│ │ ├── app.component.ngsummary.json
│ │ ├── app.component.scss.shim.ngstyle.js
│ │ ├── app.component.scss.shim.ngstyle.js.map
│ │ ├── app.component.scss.shim.ngstyle.ts
│ │ ├── app.module.ngfactory.js
│ │ ├── app.module.ngfactory.js.map
│ │ ├── app.module.ngfactory.ts
│ │ └── app.module.ngsummary.json
│ └── main.ngsummary.json
├── src
│ ├── auth
│ │ ├── app
│ │ │ ├── app.component.html
│ │ │ ├── app.component.js
│ │ │ ├── app.component.js.map
│ │ │ ├── app.component.scss
│ │ │ ├── app.component.ts
│ │ │ ├── app.module.js
│ │ │ ├── app.module.js.map
│ │ │ └── app.module.ts
│ │ ├── main.js
│ │ ├── main.js.map
│ │ ├── main.ts
│ │ ├── polyfills.js
│ │ ├── polyfills.js.map
│ │ ├── polyfills.ts
│ │ ├── vendor.js
│ │ ├── vendor.js.map
│ │ └── vendor.ts
├── node_modules
├── tsconfig.json
├── tslint.json
├── typedoc.json
└── webpack.config.js
为什么生成“编译”目录后还没有删除源目录中不必要的map / js文件?怎么做autoremove?
因为,webpack不再在我的目录源
中使用这些文件(map / js)$ webpack
main.ts
/* main */
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from '../../compiled/source/auth/app/app.module.ngfactory';
import { enableProdMode } from '@angular/core';
if (process.env.TYPE === 'prod') {
enableProdMode();
}
export function main(): Promise<any> {
return platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
}
export function bootstrapDomReady() {
document.addEventListener('DOMContentLoaded', main);
}
bootstrapDomReady();
tsconfig.js
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noEmitHelpers": true
},
"compileOnSave": false,
"buildOnSave": false,
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"angularCompilerOptions": {
"genDir": "compiled",
"skipMetadataEmit" : true
}
}