Search code examples
buildpolymerpolymer-2.x

Polymer 2.x Build Error - Multiple global declarations of class with identifier Polymer.Element


For every element that I have defined in a Polymer 2.x project I get the following warning:

Multiple global declarations of class with identifier Polymer.Element

The build ultimately fails with a Promise rejection at ...\node_modules\polymer-build\lib\analyzer.js

Are these components improperly defined?

How can I properly build the project?

My polymer.json file is

{
  "entrypoint": "index.html",
  "shell": "src/shop-app.html",
  "fragments": [
    "src/lazy-resources.html"
  ],
  "sources": [
    "src/**/*",
    "data/**/*",
    "images/**/*",
    "app.yaml",
    "bower.json",
    "manifest.json",
    "sw-precache-config.js",
    "Web.config"
  ],
  "extraDependencies": [
    "manifest.json",
    "bower_components/webcomponentsjs/webcomponents-lite.js"
  ],
  "lint": {
    "rules": ["polymer-2-hybrid"]
  },
  "builds": [{
    "js": {"minify": true},
    "css": {"minify": true},
    "html": {"minify": true}
  }]
}

Solution

  • This error means that you load the same dependency from two different urls. For instance

    myStuff/myApp.html
    myOtherStuff/myApp.html