Search code examples
polymerweb-componentecmascript-6systemjs

Web Components, Polymer and SystemJS


Does Polymer and/or native Web Components use ES6's SystemJS modules technology? https://github.com/systemjs/systemjs

Or do they rely on their own asset management?


Solution

  • Existing Web Components don't really use SystemJS but it's now possible to use it with systemjs-plugin-html to load HTML imports and circumvent the issues they have. SystemJS can redirect paths so that for example the same library expected in different locations can be redirected to the same file, and components can be more freely placed in different directories. Of course, this doesn't fix paths in the <link rel="import"> tags of existing components but new components can be created without them, while still more flexibly re-using existing components.

    I've written an article with downloadable code and a working demo for how to use Polymer with SystemJS and TypeScript.