Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

343
Views
HMR fails with Angular 9 + IVY: Type AppComponent is part of the declarations of 2 modules: AppModule and AppModule

Affected Package

HMR + IVY

Is this a regression?

pre-IVY, it works

Description

Seems IVY and HMR don't play well together? However I've seen tickets of them that are closed so I suppose it should be possible. I have on re-load after code change:

Unnhandled Promise rejection: Type AppComponent is part of the declarations of 2 modules: AppModule and AppModule! Please consider moving AppComponent to a higher module that imports AppModule and AppModule. You can also create a new NgModule that exports and includes AppComponent then import that NgModule in AppModule and AppModule. Type Background is part of the declarations of 2 modules: AppModule and AppModule! Please consider moving Background to a higher module that imports AppModule and AppModule. You can also create a new NgModule that exports and includes Background then import that NgModule in AppModule and AppModule.

...

We can see how others investigated better: https://www.gitmemory.com/issue/storybookjs/storybook/8494/551763214

๐ŸŒ Current Environment

Angular Version:

ng 9.0.1

cli 9.0.1

over 4 years ago ยท Santiago Trujillo
1 answers
Answer question

0

Toggle on AOT in your angular.json config file, that should do it

Here is the structure of where:

{
  "projects": {
    "x": {
      "architect": {
        "build": {
          "options": {
            "aot": true,
          },
          "configurations": {
            "local": {
              "aot": true
            },

Alternatively, just for testing purposes, you can run with the aot flag instead

ng serve --aot=true

Update

As of Angular version 11 it is fully functional again

## Update

Note this is only fixing so you can actually work on your project, for now. The angular team is working on a solution so we can get our fully HMR support back, hopefully very soon.

Look here for the related issue in the angular repo https://github.com/angular/angular/issues/35265

And here for the PR put out to fix it (still in draft) https://github.com/angular/angular/pull/37474

over 4 years ago ยท Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!