javascriptpolymermixinspolymer-2.xpolymer-cli

polymer build: Warning [unknown-superclass] - Unable to resolve superclass superClass


Trying to build my polymer 2.0 project, but every time I try no matter the preset (es5-bundled, es6-bundled) or separate flags, I get the following warning for the one mixin I have:

EdmMac: public vedtam$ polymer build
info:    Clearing build/ directory...
info:    (default) Building...

    const DatastoreMixin = (superClass) => class extends superClass {
                                                         ~~~~~~~~~~
src/mixins/datastore-mixin.html(1,57) warning [unknown-superclass] - Unable to resolve superclass superClass
info:    (default) Build complete!

build object:

  "builds": [{
    "name": "default",
    "bundle": true,
    "js": {"compile": true},
    "css": {"minify": true},
    "html": {"minify": true},
    "addServiceWorker": true
  }]

Caller: app-main.html:

class MyApp extends Polymer.GestureEventListeners(DatastoreMixin(ReduxMixin(Polymer.Element))) {

DatastoreMixin:

<script>
    DatastoreMixin = function(superClass) {
      return class extends superClass {
        constructor() {
          super();
        }

        static get properties() {
          return {
            bar: {
              type: Object
            }
          };
        }

      }
    }
</script>

Versions & Environment

What could be wrong?


Solution

  • In case if anyone is hitting the same issue, I got an answer from the Polymer devs, as a fix you need to use the /* @polymerMixin */ annotation:

    <script>
        /* @polymerMixin */
        DatastoreMixin = function(superClass) {
          return class extends superClass {
            constructor() {
              super();
            }
    
            static get properties() {
              return {
                bar: {
                  type: Object
                }
              };
            }
    
          }
        }
    </script>