聚合物构建:警告[unknown-superclass] - 无法解析超类superClass

时间:2017-07-05 20:40:48

标签: javascript polymer mixins polymer-2.x polymer-cli

尝试构建我的聚合物2.0项目,但每次我尝试无论预设(es5-bundled,es6-bundled)还是单独的标志,我都会收到以下警告:

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!

构建对象:

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

来电者: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>

版本&amp;环境

  • Polymer CLI:1.1.0
  • node:v6.10.3
  • 操作系统:OSX 10.10.5

可能出现什么问题?

2 个答案:

答案 0 :(得分:7)

如果有人遇到同样的问题,我得到了Polymer devs的回答,作为修复,您需要使用/* @polymerMixin */注释:

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

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

      }
    }
</script>

答案 1 :(得分:0)

这是我的代码,我没有得到任何我知道的警告:p

const GrainUpdateInlineStyleBehavior = subclass => class extends subclass {