Tools: Update to 0.16.0 broke image links on build/bundled?

Created on 30 Aug 2016  Â·  8Comments  Â·  Source: Polymer/tools

I updated to 0.16.0 and polymer build, now all image links are not correct.

I have gotten the warn: Unable to optimize .js , but that's not new.

Everything still works correct in development environment.

Any ideas?

Output:

Oneeezy@Oneezy MINGW64 ~/Desktop/www_/_clients/diesel/wwwSFI (master)
$ polymer --version
0.16.0

Oneeezy@Oneezy MINGW64 ~/Desktop/www_/_clients/diesel/wwwSFI (master)
$ polymer build
info:    Building application...
info:    Generating build/unbundled...
info:    Generating build/bundled...
warn:    Unable to optimize .js file C:\Users\Oneeezy\Desktop\www_\_clients\diesel\wwwSFI\src\data-category-cms.html_script_0.js
{ err:
   { message: 'SyntaxError: Unexpected token: name (staticThis)',
     filename: 0,
     line: 118,
     col: 12,
     pos: 5416,
     stack: 'Error\n    at new JS_Parse_Error (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:1545:18)\n    at js_error (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:1553:11)\n    at croak (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:2092:9)\n    at token_error (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:2100:9)\n    at unexpected (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:2106:9)\n    at semicolon (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:2126:56)\n    at simple_statement (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:2317:73)\n    at eval (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:2186:19)\n    at eval (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:2139:24)\n    at block_ (eval at <anonymous> (C:\\Users\\Oneeezy\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\polymer-cli\\node_modules\\uglify-js\\tools\\node.js:28:1), <anonymous>:2432:20)' } }
info:    Build complete!

Oneeezy@Oneezy MINGW64 ~/Desktop/www_/_clients/diesel/wwwSFI (master)
$ polymer serve build/bundled
Starting Polyserve...
    serving on port: 8080
    from root: C:\Users\Oneeezy\Desktop\www_\_clients\diesel\wwwSFI\build\bundled

Files in this directory are available under the following URLs
    applications: http://localhost:8080
    reusable components: http://localhost:8080/components/sfi/
cli wontfix

Most helpful comment

Created a PR to fix this in shop

All 8 comments

Can you describe how they are broken? Can you create steps for someone else to reproduce on their machine?

Yes, sorry about that @FredKSchott ,


OS: Windows 10 (64-bit)
Git SCM: 2.7.0 (MINGW64)
Node: 6.3.0
Polymer-CLI: 0.16.0
Repo: https://github.com/oneezy/shopSFI
Live: https://sulphurfuelinjection.com _(Polymer CLI - v0.12.0)_

Steps to reproduce:

  1. $ git clone https://github.com/oneezy/shopSFI.git
  2. $ cd shopSFI
  3. $ bower install
  4. $ polymer serve --open (✔ image links working)
  5. $ polymer build
  6. $ polymer serve build/bundled (✖ - image links not working)

For whatever reason, none of the images in our app are serving the correct URL from build/bundled. Product images are loading, but they are being pulled from a different resource.

I solved a similar problem by adding to polymer.json "sourceGlobs": ["images/**/*"]

Thanks @dimon-durak, this fixed the issue.

Cross referencing a similar PSK2 issue:
https://github.com/PolymerElements/polymer-starter-kit/issues/903

From the new PSK2 app inside Polymer.json , you can see the following code:

PSK2 (polymer.json):

{
  "entrypoint": "index.html",
  "shell": "src/my-app.html",
  "fragments": [
    "src/my-view1.html",
    "src/my-view2.html",
    "src/my-view3.html",
    "src/my-view404.html"
  ],
  "sourceGlobs": [
   "src/**/*",
   "images/**/*",
   "bower.json"
  ],
  "includeDependencies": [
    "manifest.json",
    "bower_components/webcomponentsjs/webcomponents-lite.min.js"
  ]
}

The issue I had was from a Polymer Shop app. So anyone that updates the CLI to 0.16.0 and are using older versions of polymer.json will run into similar issues.

Polymer Shop (polymer.json):

{
  "entrypoint": "index.html",
  "shell": "src/shop-app.html",
  "fragments": [
    "src/shop-list.html",
    "src/shop-detail.html",
    "src/shop-cart.html",
    "src/shop-checkout.html",
    "src/lazy-resources.html"
  ]
}

Created a PR to fix this in shop

Can anyone confirm that shop was building correctly with v0.15.0 or earlier? I can't get this working in v0.15.0 and nothing in any recent commits would have caused this. I'm starting to think it was never working without the --include-dependencies/--sources flags.

I had 0.12.0 build/bundled _working_ (had like 5 or 6 warnings). Not sure if a complete fresh copy of the shop app would build smoothly.

I only noticed the broken images problem when updating to 0.16.0

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NeoLegends picture NeoLegends  Â·  3Comments

MaKleSoft picture MaKleSoft  Â·  3Comments

rasto68 picture rasto68  Â·  4Comments

justinfagnani picture justinfagnani  Â·  4Comments

rwatts3 picture rwatts3  Â·  3Comments