tools: Some element import paths breaks build command

Description

Using latest release I end up with build errors if I import some elements like iron-ajax or paper-tooltip.

Versions & Environment

  • Polymer CLI: 0.14.0
  • node: v4.4.7
  • Operating System: Ubuntu 16.04

Steps to Reproduce

  1. Create an application project: polymer init application
  2. Add script tag to mainelem-app.html: <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
  3. Build: polymer build

Expected Results

No errors are thrown

Actual Results

ergo@ergo-virtual-machine:~/fdgdgdssdg$ polymer build
info:    Building application...
info:    Generating build/unbundled...
info:    Generating build/bundled...
error:   Promise rejection: Error: file path is not in root: /bower_components/promise-polyfill/Promise.js (/home/ergo/fdgdgdssdg)
error:   Error: file path is not in root: /bower_components/promise-polyfill/Promise.js (/home/ergo/fdgdgdssdg)
    at Object.urlFromPath (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/path-transformers.js:41:15)
    at StreamAnalyzer.getFile (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:107:39)
    at StreamResolver.accept (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:210:34)
    at FileLoader.request (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/loader/file-loader.js:64:27)
    at Object.<anonymous> (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:318:26)
    at Array.map (native)
    at Object.inlineScripts (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:311:34)
    at Object.<anonymous> (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:458:21)
    at run (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:87:22)
    at /home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:100:28
error:   Promise rejection: Error: file path is not in root: /bower_components/promise-polyfill/Promise.js (/home/ergo/fdgdgdssdg)
error:   Error: file path is not in root: /bower_components/promise-polyfill/Promise.js (/home/ergo/fdgdgdssdg)
    at Object.urlFromPath (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/path-transformers.js:41:15)
    at StreamAnalyzer.getFile (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:107:39)
    at StreamResolver.accept (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:210:34)
    at FileLoader.request (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/loader/file-loader.js:64:27)
    at Object.<anonymous> (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:318:26)
    at Array.map (native)
    at Object.inlineScripts (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:311:34)
    at Object.<anonymous> (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:458:21)
    at run (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:87:22)
    at /home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:100:28

Same code builds fine for me using 0.13.0

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 54 (25 by maintainers)

Commits related to this issue

Most upvoted comments

@FredKSchott If this helps a bit I’ve found something interesting, (in my test example).

if i change:

<link rel="import" href="/src/build-test-app/build-test-app.html">

to:

<link rel="import" href="src/build-test-app/build-test-app.html">

Making it a relative path the build command finishes successfully and iron-ajax is inline in the resulting file.

Adding a polymer.json to my project fixed this issue for me.

Actually, for me, the problem was that I was not returning an empty object in the properties(). I was writing this:

static get properties() { }

Instead of:

static get properties() { return {} }

Completing all my custom element resolved the problem.

polymer-build is currently being moved over to the new analyzer (see https://github.com/Polymer/polymer-build/pull/54). Once that has landed we can update the CLI and fix this for everyone once and for all (famous last words 😃.

Hang tight…

@yveslange @Skmsoumya

“Turns out there was a random undefined function that was added in awhile ago but never used and never caused any problems until the build time” - @sammymhowe

That was the error @sammymhowe was having.

@yveslange that worked for me as well. Thanks!

@FredKSchott Having the same issue. Looking forward to the fix. Thank you!