3

I am currently starting a new angular project, and I would like to implement HMR (Hot Module Replacement).

I have done each and every step described in the tutorial, but I get the following errors:

Using the latest angular version. Fresh project setup.

enter image description here enter image description here

Tanasos
  • 3,928
  • 4
  • 33
  • 63

2 Answers2

6

NOTE: I have found the most relevant tutorial (in my opinion) , because I also swapped my code snippets with the ones described in it, so please use this one for reference.

The problem with the Project does not exist. error was that I have forgot to add the local name (directory name) of the project in angular.json

enter image description here

Must become:

enter image description here

And, voila:

enter image description here

Tanasos
  • 3,928
  • 4
  • 33
  • 63
  • 1
    Thank you so much, I followed the the most relevant tutorial and the answer you give and it works completely find. – Louay Al-osh Oct 19 '19 at 06:50
3

The error message is pretty good in this case: project does not exist.

  1. Check your angular.json file.

    a. find key "defaultProject". it should be name of your project.

    b. find key projects. by default, it should have only object with your project name.

  2. Either you can add a new project with required configuration or just rename both defaultProject value and project project object key.

    angular.json project

If you have set HMR correctly then all should go well otherwise you will find below error:

Configuration 'hmr' is not set in the workspace.

Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
Irshad Ali
  • 1,153
  • 1
  • 13
  • 39