Ionic 5 - Angular 11 and Hot Module Replacement

Let me buy you a drink! Thx

1 Like

I don’t see separatedArgs in my latest CLI version.

Can you please give me the link of existing issue too?

It is in the function createOptionsFromCommandLine. Not the one calling.

Yeah there is no createOptionsFromCommandLine in server.js but this function called in server.js at the mentioned line

there are multiple server.js. I think I used the one in lib (but would have to check).

Ok, that in the different path as there are many server.js path for it \npm\node_modules\@ionic\cli\lib\serve.js line 107:

While I confirm hmr enabled from logs, but it still refreshes the page.

Well, I guess if the module relates to the page shown, you can’t avoid a page reload. Maybe on CSS It should be more relaxed…

And I still have to check a case I seemed to have where the app looses the injected service. Not sure if that was because of HMR or a bug. Either way, an error I have never encountered before.

Tried HTML, SCSS and TypeScript everything refreshes the page

1 Like

Well, too bad. But recompile time beefed up. So some benefit, right? Ideally pages wouldn’t loose state. A refresh aside.

Everything refreshes the page!
I open another issue for that:

Yup. This is happening. So, just be care, it may still be too experimental :slight_smile:


Any solution for this in 2022?

I have an angular 10 project that I opened at work. after a while, when I saw that HMR added to angular 11 I upgraded the project by trying to work with HMR. Since it didn’t, I opened a brand new angular project. checked that HMR working. I moved all components, services, modules, styles (without node folder of course) and launched it using ng serve --hmr and it failed to work again. the page is being refreshed.

I am on this 3 days. Any idea will be appreciated?. .

This is what I did to get HMR running on my setup.

Hacky, but working

Angular HMR feature is not perfect.

I faced that whole app was refreshed beacause of lazy module.

Hello Sir,

I have faced a issue. I can’t run my project. Please me, how can I solve my problem?
I have shared my issue. Please check it.

PS D:\Office Project\UCMMobile> ionic serve

npm.cmd run ionic:serve – --host=localhost --port=8100 --project=app
[npm] > newucm@0.0.1 ionic:serve
[npm] > ionic-app-scripts serve “–host=localhost” “–port=8100” “–project=app”
[npm] ‘ionic-app-scripts’ is not recognized as an internal or external command,
[npm] operable program or batch file.

[ERROR] npm has unexpectedly closed (exit code 1).

    The Ionic CLI will exit. Please check any output above for error details.