Inheritance In Components Makes Build Error
See original GitHub issueI have a parent Component like this:
import { Component} from '@angular/core';
@Component({
selector: 'app-main-parent',
template: '',
})
export class ParentComponent {
constructor(protected service) {
service.doSomething();
}
}
and a child Component that extends parent:
import { Component} from '@angular/core';
import { ChildService} from './services';
@Component({
selector: 'app-main-child',
templateUrl: './child.component.html',
})
export class ChildComponent extends ParentComponent{
constructor(private _childService: ChildService) {
super(_childService);
}
}
and in main.module.ts added these components:
import { NgModule } from '@angular/core';
import { ParentComponent,
ChildComponent } from './components'
@NgModule({
imports: [
...
],
declarations: [
ParentComponent,
ChildComponent,
...
],
providers: [
...
]
})
export class MainModule { }
I build project with following command:
npm run build
And got this Error:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! proj.panel@0.0.0 build: ng build --aot --prod --stats-json
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the proj.panel@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2018-01-17T10_37_32_166Z-debug.log
If I remove ParentComponent from main.module.ts, then get this Error:
Cannot determine the module for class ParentComponent in C:/Users/user/source/repos/proj/web-panel/app/main/components.ts! Add ParentComponent to the NgModule to fix it.
Other Stuff:
if I run project with npm start
command it works fine. only in build I got these Errors.
I ran build command with no aot (ng build --no-aot --prod
) but errors are still there.
I dont use ParentComponent anywhere but for childs components to extend.
Angular version: 5.0.0
For Tooling issues:
- Node version: 6.11.4
- Platform: Windows 10
- npm version: 5.6.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Thanks for reporting this issue. However this issue is a duplicate of an existing issue #16637. Please subscribe to that issue for future updates.
Duplicate of #16566, see https://github.com/angular/angular/issues/16566#issuecomment-337960028EIDT: duplicate of #16637