analogjs / analog

The fullstack meta-framework for Angular. Powered by Vite and Nitro
https://analogjs.org
MIT License
2.57k stars 245 forks source link

Bug: client hydration stats not correctly displayed in Analog project #345

Closed brandonroberts closed 1 year ago

brandonroberts commented 1 year ago

Please provide the environment you discovered this bug in.

After creating a new Angular v16 project with Analog, in development mode

Which area/package is the issue in?

create-analog

Description

When provideClientHydration() is used, the numbers do not show correctly.

Angular hydrated NaN component(s) and NaN node(s), undefined component(s) were skipped. Note: this feature is in Developer Preview mode. Learn more at https://next.angular.io/guide/hydration.

This is due to how ngDevMode is set in the vite plugin

https://github.com/analogjs/analog/blob/main/packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts#L119

This used to be set to an empty object in development mode, now its not defined at all in development, and set to false during the build for production.

Please provide the exception or error you saw

No response

Other information

The fix

define: {
  ngJitMode: 'false',
  ngI18nClosureMode: 'false',
  ...(watchMode ? {} : { ngDevMode: 'false' }),
},

I would be willing to submit a PR to fix this issue

goetzrobin commented 1 year ago

I can work on this. Also open to add the good-first-issue label to this since the solution is already provided and it could be an invitation for people to dive into the source code

brandonroberts commented 1 year ago

Good first issue is fine with me