New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception: Already registered (Polymer) prototype for element x #21332
Comments
Added Pkg-Polymer, Triaged labels. |
Added Area-Pkg label. |
Set owner to @jakemac53. |
Looks like an issue with out inliners, if the same dart file is seen more than once then the extras should just be ignored but we are inlining it each time. This isn't actually a new bug, it was just being hidden previously since there was a bug in the check for duplicate registrations googlearchive/polymer-dev@71d2041. |
Fixed in r41245, but this will still throw a warning. The real solution for you here should be to put your script file in its own html file, and import that instead of your script. |
Added Fixed label. |
published as 0.15.0+2 |
This comment was originally written by defaveri...@gmail.com With "The real solution for you here should be to put your script file in its own html file, and import that instead of your script." do you mean "put your script file in its own DART file, and import that instead of the entire library?" |
This comment was originally written by @mareksuscak Well if you use build logs in output that show warnings on the page then if you click "more" button you will find exact instructions how to workaround it. In summary you have to create an HTML file (e.g. script_thats_used_multiple_times.html) with the following content: <!DOCTYPE html> then of course delete the original <script> from all polymer components that used this file previously and put the import above the <polymer-element> <link rel="import" href="script_thats_used_multiple_times.html"> which will import previously created HTML file. Simple. |
This issue has been moved to dart-archive/polymer-dart#323. |
This issue was originally filed by def...@gmail.com
I've two polymer elements that share the same dart file. In the dart file I declare both the PolymerElement classes.
Until polymer 0.15.0+1 it was working fine. I've updated the project to polymer 0.15.1 and now I get this exception:
Exception: Already registered (Polymer) prototype for element my-polymer-a
Where my-polymer-a is the first declared polymer.
I think the polymer transformer is trying to register it two times, the first scanning the my-polymer-a html file, the second when scanning the my-polymer-b html file.
This issues breaks our current use of polymer elements and we're forced to refactor a large codebase towards many finer-grained libs we don't really need and will find difficult to move about as we refactor.
Here the code:
mypolymerA.html
<link rel="import" href="packages/polymer/polymer.html">
<polymer-element name="my-polymer-a">
<template>
<div>Hello I'm A</div>
</template>
<script type="application/dart" src="mypolymers.dart"></script>
</polymer-element>
mypolymerB.html
<link rel="import" href="packages/polymer/polymer.html">
<polymer-element name="my-polymer-b">
<template>
<div>Hello I'm B</div>
</template>
<script type="application/dart" src="mypolymers.dart"></script>
</polymer-element>
mypolymers.dart
import 'package:polymer/polymer.dart';
@CustomTag('my-polymer-a')
class MyPolymerA extends PolymerElement {
MyPolymerA.created() : super.created();
}
@CustomTag('my-polymer-b')
class MyPolymerB extends PolymerElement {
MyPolymerB.created() : super.created();
}
The text was updated successfully, but these errors were encountered: