Open martin-yumsto opened 2 days ago
I didn't get it. My zoneless SSR app builds just fine with v19.
@e-oz do you use file based polyfill ?
I just noticed I forgot to include the error log so it's here:
✘ [ERROR] Could not resolve "zone.js/node"
angular:polyfills-server:angular:polyfills-server:2:7:
2 │ import 'zone.js/node';
Basically for the server side package build the condition that detects whether it should build zone-based or zoneless app is very generic and it matches "zone.js" or any other js/ts file inside the polyfills array. So I suppose even empty file specified in that array inside angular.json build will cause the error.
polyfills.ts (window as any).global = window; // Amplify
I guess that this thing alone will throw an exception on the server side.
In my polyfills I have only link to localize.
Which @angular/* package(s) are the source of the bug?
compiler-cli
Is this a regression?
No
Description
I'm trying to go zoneless for my SSR angular app with hydration.
This condition seems to cause difficulties to migrate to zoneless for any SSR app that uses file based polyfills: https://github.com/angular/angular-cli/blob/d622e594878611c4a00aab94e15ce2dcf108b088/packages/angular/build/src/tools/esbuild/application-code-bundle.ts#L175
I guess you are aware of the issue, since there is a todo on the condition that feels too generic: https://github.com/angular/angular-cli/blob/d622e594878611c4a00aab94e15ce2dcf108b088/packages/angular/build/src/tools/esbuild/utils.ts#L470
Basically it adds
zone.js/node
import for all the builds that have file polyfill.Minimal repro would be:
angular.json:
"polyfills": ["@angular/localize/init", "polyfills.ts"]
polyfills.ts
(window as any).global = window; // Amplify
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response