Polymer / tools

Polymer Tools Monorepo
BSD 3-Clause "New" or "Revised" License
430 stars 200 forks source link

polymer build --js-minify flag breaks iron-ajax for Polymer 1 #2419

Open soumyart opened 7 years ago

soumyart commented 7 years ago

Description

Iron-ajax is not working after minifying the code using latest cli for Polymer 1 application. Once removed the --js-minify flag ajax worked as expected.

polymer.josn
{
  "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"
  ],
  "sources": [
    "src/**/*",
    "images/**/*",
    "JSONs/*",
    "bower.json"
  ],
  "extraDependencies": [
    "manifest.json",
    "bower_components/webcomponentsjs/webcomponents-lite.min.js"
  ]
}
iron-ajax
<iron-ajax
      auto handle-as="json" 
      url="../JSONs/data.json" 
      on-response="handleResponse"></iron-ajax>

Versions & Environment

Steps to Reproduce

  1. Create an application project: polymer init polymer-1-starter-kit
  2. Add iron-ajax#^1.0.0 dependency from bower.
  3. Add iron-ajax in my-view2.html page.
  4. Build: polymer build --js-compile --js-minify --css-minify --html-minify --bundle
  5. Serve: polymer serve build\default

Expected Results

Application should run and Iron ajax should fetch the data.

Actual Results

Iron ajax event not fired.

christophe-g commented 7 years ago

Experiencing same issue

Versions & Environment

Polymer CLI: 0.18.1 node: v6.10.2 Operating System: Linux

C.

christophe-g commented 7 years ago

also fixed by https://github.com/Polymer/polymer-cli/pull/698 C.

doughaase commented 7 years ago

Experiencing the same issue here

Versions & Environment Polymer CLI: 0.18.1 node: v6.9.4 Operating System: Linux

Iron ajax is not firing.

698 changes didn't fixed the issue for me

super({presets: [babiliPreset(null, {'unsafe': {'simplifyComparisons': false }})]});

Is there anything else that needs to be changed?

christophe-g commented 7 years ago

Sorry to ask, but did you re-build polymer-cli after the change ? It does work for me with similar config. C.

doughaase commented 7 years ago

Sorry, forgot about that.

I've downloaded the updated repo and tried npm run build

Output was an error:

11 silly lifecycle polymer-cli@0.18.1~build: Args: [ '/d /s /c', 'gulp build' ]
12 silly lifecycle polymer-cli@0.18.1~build: Returned: code: 1  signal: null
13 info lifecycle polymer-cli@0.18.1~build: Failed to exec build script
14 verbose stack Error: polymer-cli@0.18.1 build: `gulp build`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:886:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid polymer-cli@0.18.1

I recently updated to node 6.10.3 and npm to 3.10.10.

btopro commented 7 years ago

this is fixed in the latest build tools

stale[bot] commented 4 years ago

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.