Asked By: Anonymous
In the default polymer.json file I see:
"extraDependencies": [ "bower_components/webcomponentsjs/*.js", "!bower_components/webcomponentsjs/gulpfile.js", "manifest.json" ],
The documentation is a little vague about it:
Dependencies that the analyzer component of the Polymer build toolchain canâ€™t discover, possibly because they’re not statically imported, and that do not need to be bundled.
- Why can’t the toolchain discover it?
- IF they cannot be discovered, why would we need to include them?
- If they “don’t need to be bundled”, what’s actually done with them?
Answered By: Anonymous
- As the documentation says, the toolchain can’t discover these files because they are not statically imported. The analyzer only knows about static imports like this:
<link rel="import" href="../bower_components/my-component.html">
Most likely your
bower_components/webcomponentsjs/*.jslibrary is being imported dynamically by checking if the browser supports web components natively, and loading in the web components polyfill if not. As for
manifest.json, it’s not imported as an HTML import, but as a manifest as follows:
<link rel="manifest" href="/manifest.json">
The extraDependencies need to be included if you are using
polymer buildto make a production build of your app, so the polymer-cli knows to include these files in your build.
The web components js files don’t need to be bundled (note that they still need to be added to the build) because you don’t want every app coming with the full web components polyfill, when browsers like Chrome already support it natively. The manifest.json should not be bundled because it is a standalone file needed to get metadata for your application.