[英]Multiple web components in same page giving error in chrome like cannot read properties of undefined (reading create) in Angular
Created two web components: web-comp-1, web-comp-2创建了两个 web 组件:web-comp-1、web-comp-2
When I tried to add in HTML page, I am getting console error like below当我尝试添加 HTML 页面时,出现如下控制台错误
Uncaught TypeError: Cannot read properties of undefined (reading 'create')
at new m.<computed> (web-comp-1.js:3:2706)
at new t (web-comp-1.js:3:12616)
When I checked the line, the code is,当我检查线路时,代码是,
(o = (u = F && 1 === a.create.length)? Reflect.construct
Generated web component using below versions and angular elements: "@angular/animations": "14.2.7", "@angular/cdk": "14.2.5", "@angular/common": "14.2.7", "@angular/compiler": "14.2.7", "@angular/core": "14.2.7", "@angular/elements": "14.2.7",使用以下版本和 angular 元素生成 web 组件: "@angular/animations": "14.2.7", "@angular/cdk": "14.2.5", "@angular/common": "14.2.7", " @angular/compiler": "14.2.7", "@angular/core": "14.2.7", "@angular/elements": "14.2.7",
Stackblitz link:https://stackblitz.com/edit/web-platform-bkqbag?file=index.html Stackblitz 链接:https://stackblitz.com/edit/web-platform-bkqbag?file=index.html
If you run in stack blitz, you wont see any error, you need to download the project and open in only "Chrome".如果你在 stack blitz 中运行,你不会看到任何错误,你需要下载项目并只在“Chrome”中打开。 This issue happening only in chrome, not in mozilla
此问题仅在 chrome 中发生,在 mozilla 中不发生
Upgraded document-register-element package from 1.7.2 to 1.14.10 in package json, the error gone away.在 package json 中将 document-register-element package 从 1.7.2 升级到 1.14.10,错误消失了。 Thank you @Abolfazl Almas, your link triggered me an idea
谢谢@Abolfazl Almas,你的链接让我想到了一个主意
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.