聚合物DomModule已定义 [英] Polymer DomModule already defined

查看:111
本文介绍了聚合物DomModule已定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个网站,在这里我会使用不同的聚合物成分,其中一些会多次使用.

I'm building a website, where I'd use different polymer components, some of them multiple times.

我的问题是编译后的代码包含

My problem is that the compiled code contains a

 customElements.define('dom-module', DomModule); 

会抛出

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry at CustomElementRegistry.value

我不知道该如何解决.

推荐答案

如果在两个不同的组件中使用两条不同的路径包含聚合物,则它们都会被执行,并且都试图定义dom-module,dom-if等.

If you include polymer using two different paths in two different components, both of them gets executed and both tries to define dom-module, dom-if etc.

因此,请检查网络面板上的文件名是否相同,但路径不同.

So check the networks panel for identical file names but different paths.

示例:

/bower_components/webcomponentsjs/webcomponents-loader.js
and
/components/webcomponentsjs/webcomponents-loader.js

这篇关于聚合物DomModule已定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆