tools: Missing bower components after running polymer build

Description

Versions & Environment

  • Polymer CLI: 0.13
  • node: v4.4.7
  • Operating System: Mac OSx 10.11.6

Steps to Reproduce

  1. Create an application project: polymer init application
  2. Install the moment.js [http://momentjs.com/] library for instance, using bower install moment --save
  3. Build: polymer build

Expected Results

The moment.js library should be in build/bundled/bower_components

Actual Results

The moment.js library is not present in build/bundled/bower_components

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 33 (10 by maintainers)

Most upvoted comments

Update This is no longer required with polymer-cli@next Well I found a process that works for me to solve the relative/absolute path conundrum I wondered into. Summed up a a shell script below.

#!/usr/bin/env bash
# "shell" must be a relative path in polymer.json.            src/app-shell.html
# "fragments" must use an absolute path in polymer.json.      /src/frag-mnt.html
# HTML imports must use relative paths inside the "shell" file.
# Tested with polymer-cli 0.17.0 and polymer 1.7.1.
polymer build
cp src/app-shell.html build/bundled/src/    # copy app shell
cp -rn bower_components build/bundled/      # copy only missing bower components

Any updates on this? I’m still facing same issue here… When using a behavior to load sensitive scripts like moment.js or some other components.

Thanks for all your feedback, everyone. We’ve been making a ton of improvements to the build process (new analyzer, more straightforward analysis, etc), which will be released in the next version. You can try a pre-release of the new build command with npm install -g polymer-cli@next.

Most of these issues should be solved in this newer version.

@antonmoiseev thanks for the clear steps, I can reproduce that.

Not sure what’s not working here, but for some reason our dependency analyzer is missing that “/bower_components/webcomponentsjs/webcomponents-lite.js” reference in your index.html. A workaround for now is to include it explicitly via the --include-dependencies flag. As an example, this fixes the issue for me:

polymer build --entrypoint index.html --shell src/myapp-app/myapp-app.html --include-dependencies bower_components/webcomponentsjs/webcomponents-lite.js

But yea, we still need to figure out why this isn’t working in the first place…

This is reproducible with a freshly generated application template:

  1. polymer init (choose application)
  2. polymer build --entrypoint index.html --shell src/myapp-app/myapp-app.html
  3. polymer serve build/bundled

webcomponentsjs is missing in build/bundled/bower_components, in the browser you see:

image

polymer-cli: 0.14.0

+1, i’m experiencing same issue, js-cookie and even webcomponent is not loaded to the /bower_components, yet it exist in bower.json on build/bundled,

workaround for now is running bower install on the build/bundled folder so firebase can pick it up.

In case this helps anyone, just ran into the same problem as noted many times above. In my case it was caused by thinking “bower install --save” was all that was required. Fixed the problem by including the page that referenced the missing dependency in the polymer.json file "fragments": [ "src/my-about.html", "src/my-admnuser.html",

like so. Fixed it immediately.

Thank you Frank!!!

On 15 Dec 2016 9:23 a.m., “Fred K. Schott” notifications@github.com wrote:

Thanks for all your feedback, everyone. We’ve been making a ton of improvements to the build process (new analyzer, more straightforward analysis, etc), which will be released in the next version. You can try a pre-release of the new build command with npm install -g polymer-cli@next.

Most of these issues should be solved in this newer version.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Polymer/polymer-cli/issues/347#issuecomment-267209329, or mute the thread https://github.com/notifications/unsubscribe-auth/ACB7XqebF310rh_CFAveMyfF93zxTz6iks5rIJaagaJpZM4JeW4Q .

@FredKSchott do you think it makes sense to add include-dependencies to the polymer.json configuration? It may be useful for projects with dynamically loaded resources like in the shop app.