I upgraded an Angular 17.3.6 project w/ SSR to use Vite/esbuild via:
ng update @angular/cli --name use-application-builder
After a couple of updates to fix relative path issues for server.ts, etc., the ng build
command began failing with:
An unhandled exception occurred: NG0908: In this configuration Angular requires Zone.js
Using the --verbose
argument shows that the Vite build process has completed scripts.js, pollyfills.server.mjs, polyfills.js, and server.mjs (among others) when it crashes. This is the trace in the error log file:
[error] Error: NG0908: In this configuration Angular requires Zone.js
at _NgZone (C:SourceReposxx.angularprerender-rootbc51c716-927a-482e-8326-e43767329597node_modules@angularcorefesm2022core.mjs:14668:19)
at getNgZone (C:SourceReposxx.angularprerender-rootbc51c716-927a-482e-8326-e43767329597node_modules@angularcorefesm2022core.mjs:14978:16)
at _PlatformRef.bootstrapModuleFactory (C:SourceReposxx.angularprerender-rootbc51c716-927a-482e-8326-e43767329597node_modules@angularcorefesm2022core.mjs:32235:24)
at <anonymous> (C:SourceReposxx.angularprerender-rootbc51c716-927a-482e-8326-e43767329597node_modules@angularcorefesm2022core.mjs:32296:41)
The only mentions of this error that I see involve zone.js not being included in a polyfills file, out-of-order loading of polyfill.js & main.js files, etc.