What are extraDependencies for in polymer.json, and what does “!” mean?

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?

Solution

Answered By: Anonymous
  1. 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/*.js library 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">

  2. The extraDependencies need to be included if you are using polymer build to make a production build of your app, so the polymer-cli knows to include these files in your build.

  3. 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.

techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno