最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - polyfills.ts does not get created with ng new <project> with the angular cli - Stack Overflow

programmeradmin2浏览0评论

I am working through some examples and learning angular. When a new project is created with the angular cli polyfills.ts is not generated. Has anyone else ran into this issue? Here is the generated file structure.

generated file structure

I have tried manually adding a polyfills.ts file to the src folder but that still does not seem to do the trick.

I am working through some examples and learning angular. When a new project is created with the angular cli polyfills.ts is not generated. Has anyone else ran into this issue? Here is the generated file structure.

generated file structure

I have tried manually adding a polyfills.ts file to the src folder but that still does not seem to do the trick.

Share Improve this question edited Dec 24, 2022 at 5:01 vimuth 5,61248 gold badges91 silver badges124 bronze badges asked Dec 24, 2022 at 3:25 D3uceeD3ucee 811 silver badge4 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 9

Since version 15 polyfills.ts is not generated and it is moved directly into angular.json. So you don’t have to add it.

You can add files in polyfills.ts using angular.json file

 for this goto angular.json file there you can see polyfills array
    where you can import your localize()

**"index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": [
          "zone.js",
          "@angular/localize/init"
        ],
**

Yes, When use use the latest angular v15 , the pollyfills.ts will not get created instead of that if you see that angular.json under pollyfills property you can see the zone has been added. enter image description here

发布评论

评论列表(0)

  1. 暂无评论