ang
ang

Reputation: 1581

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}
  }]
}

Upvotes: 0

Views: 555

Answers (3)

Prasanta Saha
Prasanta Saha

Reputation: 11

I too had same warning and it was gone after cleaning bower_components and node_modules.

Upvotes: 0

Katrin Klimat
Katrin Klimat

Reputation: 81

I had the same warning while building my Polymer 2 app. Probably because some of my elements import the same other elements and all of them extend Polymer.Element. I have checked all my elements for duplicate imports. Maybe some third party elements have duplicates, but my elements didn't.

So I added the warning to the ignore list in polymer.json:

{
  "lint": {
    "rules": [
      "polymer-2"
    ],
    "ignoreWarnings": ["multiple-global-declarations"]
  },
  ...
}

Upvotes: 1

Pascal L.
Pascal L.

Reputation: 1259

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

myStuff/myApp.html
myOtherStuff/myApp.html

Upvotes: 2

Related Questions