简体   繁体   中英

Vulcanize - where is polymer.js getting imported from?

I have a imports.html page below that I am vulcanizing.

What is strange is....normally in my index.html I have <link rel="import" href="bower_components/polymer/polymer.html"> ....which is not in imports.html . But when I vulcanize imports.html , somehow it gets included and I have to remove <link rel="import" href="bower_components/polymer/polymer.html"> from my index.html . Otherwise, I would get

Uncaught NotSupportedError: Failed to execute 'registerElement' on 'Document': Registration failed for type 'dom-module'. A type with that name is already registered.

Where is polymer.html coming from when I vulcanize imports.html ? Because it's not in imports.html .


!-- custom style sheets-->
<link rel="stylesheet" href="css/splash.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/fade-title-animation.css">
<link rel="stylesheet" href="css/paper-ripple.css">
<link rel="stylesheet" href="css/slider-animation.css">
<link rel="stylesheet" href="bower_components/components-font-awesome/css/font
-awesome.min.css">
<!-- custom style sheets-->

<!-- bower components -->
<link rel="import" href="bower_components/paper-menu/paper-menu.html">
<link rel="import" href="bower_components/paper-item/paper-item.html">
<link rel="import" href="bower_components/paper-drawer-panel/paper-drawer-panel.html">
<link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="bower_components/paper-header-panel/paper-header-panel.html">
<link rel="import" href="bower_components/iron-collapse/iron-collapse.html">
<link rel="import" href="bower_components/iron-icon/iron-icon.html">
<link rel="import" href="bower_components/iron-icons/editor-icons.html">
<link rel="import" href="bower_components/paper-ripple/paper-ripple.html">
<link rel="import" href="bower_components/iron-icons/iron-icons.html">
<link rel="import" href="bower_components/iron-icons/image-icons.html">
<link rel="import" href="bower_components/paper-toolbar/paper-toolbar.html">
<link rel="import" href="bower_components/paper-material/paper-material.html">
<link rel="import" href="bower_components/paper-card/paper-card.html">
<link rel="import" href="bower_components/iron-media-query/iron-media-query.html">
<link rel="import" href="bower_components/paper-fab/paper-fab.html">
<link rel="import" href="bower_components/paper-button/paper-button.html">
<link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="bower_components/paper-tabs/paper-tabs.html">
<!-- bower components -->

<!-- custom elements -->
<link rel="import" href="elements/portfolio/cards/card-behavior.html">
<link rel="import" href="elements/page-behavior.html">
<link rel="import" href="elements/page-styles.html">
<link rel="import" href="elements/footer-custom.html">
<link rel="import" href="elements/toolbar-menus/paper-menu-custom.html">
<link rel="import" href="elements/toolbar-menus/paper-tabs-custom.html">
<link rel="import" href="elements/portfolio/cards/portfolio-card-styles.html">
<link rel="import" href="elements/portfolio/portfolio-display.html">
<link rel="import" href="elements/portfolio/portfolio-page.html">
<link rel="import" href="elements/portfolio/cards/cloud-share-image-card.html">
<link rel="import" href="elements/portfolio/cards/cloud-monitor-card.html">
<link rel="import" href="elements/portfolio/cards/legacy-darin-card.html">
<link rel="import" href="elements/portfolio/cards/dad-site-card.html">
<link rel="import" href="elements/portfolio/cards/gulp-newy-card.html">
<link rel="import" href="elements/portfolio/cards/darin-hensley-card.html">
<link rel="import" href="elements/portfolio/cards/krunch-uploader-card.html">
<link rel="import" href="elements/resume/resume-page.html">
<link rel="import" href="elements/resume/resume-display.html">
<link rel="import" href="elements/contact-display.html">
<!-- custom elements -->

<!-- js -->
<script src="js/misc.js" ></script>
<script src="bower_components/page/page.js"></script>
<script src="js/router.js"></script>
<script src="js/resume.js"></script>
<script src="js/pdf.js"></script>
<script src="js/pdf.worker.js"></script>
<script src="js/initialize.js" defer></script>
<!-- js -->

You have one of the element that import polymer.html go over the custom element and check what file contain this import.(I think that all the polymer-elements contains this import) Vulcanize scan recursively for imports.

The real problem is that you vulcanize only the import file and not all the index. if you want to vulcanize only the imports.html file you have to put all the imports inside this file.

In regular case what happand (before you vulcanize)

The browser parse the html file. if it has 2 imports with same url it import it once.

In your case, vulcanize the imports file.

now it includes the polymer.html and then when you import this file on the index, the browser dont know that in the vulcanized file you have polymer.html file. so it import it again..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM