Reputation: 705
I just upgraded to Angular 18 and I get the following warning when I do ng serve
:
▲ [WARNING] Polyfill for "@angular/localize/init" was added automatically. [plugin angular-polyfills]
In the future, this functionality will be removed. Please add this polyfill in the "polyfills" section of your "angular.json" instead.
angular.json
"build": {
"builder": "@angular-devkit/build-angular:browser-esbuild",
"options": {
"outputPath": "dist/MyClientApp",
"main": "src/main.ts",
"index": "src/index.html",
"polyfills": [
"src/polyfills.ts"
],
"tsConfig": "tsconfig.app.json",
polyfills.ts contains the line:
...
import '@angular/localize/init';
...
What could be missing? I have in package.json
the "@angular/localize": "^18.0.3",
Upvotes: 35
Views: 12056
Reputation: 483
Add "@angular/localize/init"
to the polyfills
array in your angular.json
.
You can then delete your polyfills file if it only contains import '@angular/localize/init';
When I did this the warning went away.
Upvotes: 44