Search code examples
polymer-2.xpolymer-starter-kit

Command `polymer build` does not add certain bower_components


I am using the polymer-starter-kit project. In that I am using the paper-toggle-button and the editor-icons.html elements. When I use polymer serve to run my project, the toggle button and the edit icon are shown in the browser. But, when I build my project using polymer build, these 2 components are not included in the bower_components folder of the build. Following is my polymer.json:

{
  "entrypoint": "index.html",
  "shell": "src/dekkho-app.html",
  "fragments": [
    "src/listing_page/dekkho-listing.html",
    "src/home_page/dekkho-home.html",
    "src/home_page/dekkho-404.html"
  ],
  "sources": [
    "src/**/*",
    "images/**/*",
    "bower.json",
    "robots.txt"
  ],
  "extraDependencies": [
    "manifest.json",
    "bower_components/webcomponentsjs/*.js"
  ],
  "lint": {
    "rules": ["polymer-2"]
  },
  "builds": [{
    "name":"es6-supported",
    "addServiceWorker": true,
    "js": {"minify": true},
    "css": {"minify": true},
    "html": {"minify": false}
  },
    {
      "name":"es5-supported",
      "addServiceWorker": true,
      "js": {"compile":true, "minify": true},
      "css": {"minify": true},
      "html": {"minify": false}
    }
  ]
}

Thanks in advance


Solution

  • Your paper-toggle-button needs to be included somewhere in your codebase or the analyzer can't find it.

    If it's not included in entrypoint (or one of it dependencies) or shell (or one of it dependencies) or fragments (or one of it dependencies) then it will not be included in the build - as the analyzer thinks it's actually not needed.

    So you either have to include it somewhere in your codebase or add it as a fragment. Depending on what fit's your need.