我正在研究一些例子并学习角度。当使用角度 cli 创建新项目时,不会生成 polyfills.ts。还有其他人遇到过这个问题吗?这是生成的文件结构。
生成的文件结构
我已经尝试手动添加一个 polyfills.ts 文件到 src 文件夹,但似乎仍然没有成功。
自版本15起polyfills.ts不生成,直接移入angular.json。所以你不必添加它。
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"
],
**