當我導入Angular材料(或任何其他包格式4.0模塊)時,AOT編譯失敗。AOT編譯失敗的角度材料或包格式4.0
import { NgModule, ModuleWithProviders } from '@angular/core';
import {MdButtonModule, MdCheckboxModule} from '@angular/material';
@NgModule({
imports: [
MdButtonModule,
MdCheckboxModule
],
exports: [
MdButtonModule,
MdCheckboxModule
]
})
export class NorSharedModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: NorSharedModule
};
}
}
當我與AOT編譯生成的ngfactory
文件角材質打造循環進口。
index.ngfactory.ts
/**
* @fileoverview This file is generated by the Angular template compiler.
* Do not edit.
* @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride}
*/
/* tslint:disable */
import * as i0 from '@angular/core';
import * as i1 from '@angular/material';
import * as i2 from '@angular/common';
import * as i3 from '@angular/platform-browser';
import * as i4 from './index.ngfactory';
import * as i5 from '@angular/forms';
import * as i6 from '@angular/http';
export const MdCoreModuleNgFactory:i0.NgModuleFactory<i1.MdCoreModule> = i0.ɵcmf(i1.MdCoreModule,
當然,這打破了構建過程的下一個步驟。彙總不能捆綁。
[8:51:38] LOG ngc started compiling ngfactory
[8:51:50] LOG ngc compiled /ngfactory
[8:51:50] LOG Rollup started bundling ngfactory
Error: A module cannot import itself
ngfactory/node_modules/@angular/material/typings/index.ngfactory.js (5:0)
3: import * as i2 from '@angular/common';
4: import * as i3 from '@angular/platform-browser';
5: import * as i4 from './index.ngfactory';
^
6: import * as i5 from '@angular/forms';
7: import * as i6 from '@angular/http';
這在4.2.0-rc.2
和4.2.0
複製。