Dart Exception: An already registered (polymer) prototype of element x

I have two polymer elements that use the same dart file. In the dart file, I declare both PolymerElement classes.

As long as the polymer 0.15.0 + 1 worked fine. I updated the project to polymer 0.15.1, and now I get this exception:

Exception: Already registered (Polymer) prototype for element x 

Where x is the first polymer.

I think that the polymer transformer tries to register it two times, the first when scanning the xml file x polymer, the second when scanning the html file of another element.

The problem was discovered in the dart: https://code.google.com/p/dart/issues/detail?id=21332

+6
source share
2 answers

The issue was "resolved" with the release of 0.15.1 + 2 , Polymer Dart .

Now the compiler issues a warning and, as indicated in the comments: β€œThe real solution for you here should be to put your script in your own html file and import it instead of the script. In the end, you should create an HTML file (for example, script_thats_used_multiple_times.html) with the following contents:

 <!DOCTYPE html> <script type="application/dart" src="script_thats_used_multiple_times.dart"></script> 

then, of course, remove the original from all polymer components that previously used this file, and set the import over

 <link rel="import" href="script_thats_used_multiple_times.html"> 

which will import the previously created HTML file. Simple. "

0
source

I don’t know about Darth and much more, but I had the same error message in my console. Turns out I still had the noscript attribute in the element declaration, which is not true if you want to register your element manually. Removing noscript from the element declaration solved the problem.

+9
source

Source: https://habr.com/ru/post/976762/


All Articles