In an attempt to create polymer elements that use requirejs modules I ran into a blocking issue. I understand that polymer is not designed to work with requirejs, but for the ti
So there's this solution from Scott Miles but I find it a bit simplistic and inflexible as it relies on:
tags to be executed in order, therefore ruling out:
async
script tagsxhr
based script loadingpolymer
getting loaded from a
tag, therefore:
layout.html
and associated css
won't be loadedpolymer.html
won't be dedupedIf you want more control over your bootstrapping logic you will need to enforce some amount of synchronisation between your components (which is what both requirejs
and polymer
are competing to do) before those are fully loaded.
The previous example is a more declarative (read polymer
) way of doing things but falls short of fine grained tuning. I've started working on a repository to show how you can fully customise your load ordering, by using a more imperative approach where requirejs
is given priority to orchestrate the rest of the bootstrapping.
At the time of writing, this extra control comes at the price of worse performance as the various scripts can't be loaded in parallel but I'm still working on optimising this.