Polymer / tools

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

--js-compile --js-minify --html-minify make jQuery crash #2382

Open baocang opened 7 years ago

baocang commented 7 years ago

Description

Versions & Environment

Steps to Reproduce

  1. Create an application project: polymer init polymer-2-application
  2. Add script tag to src/app-shell/app-shell.html <script src="jquery-3.2.0.js"></script>
  3. Update webcomponentsjs in bower.json to #1.0.0-rc.7
  4. Update bower components: bower update
  5. Build: polymer build --entrypoint index.html --shell src/app-shell/app-shell.html --bundle --js-compile --js-minify --html-minify
  6. Serve: polymer serve build/default
  7. Open in chrome: http://127.0.0.1:8000

Expected Results

No error is throw

Actual Results

Error is thrown

error
baocang commented 7 years ago

image

web-padawan commented 7 years ago

Might be related to https://github.com/babel/babel/issues/340

BTW, why to use jQuery with Polymer? You might not need it at all, and take into account that in case of DOM manipulations, jQuery is not aware of Shadow DOM.

baocang commented 7 years ago

I'm trying to build a SaaS application wtihout jQuery, But some thirdpart library not sure. such as: http://www.highcharts.com, https://www.mobiscroll.com 😪.

FredKSchott commented 7 years ago

@baocang Can you try each of those flags individually, to see which is causing the issue? My guess is it's just --js-compile but it could also be --js-minify.

We have a task to add the ability to whitelist files to be skipped for processing. If some popular files are currently broken we should bump up the priority.

baocang commented 7 years ago

@FredKSchott --bundle --js-minify.

baocang commented 7 years ago

@FredKSchott polymer build --js-minify with no error in console. but the code \x20 has already translated to unicode char.

FredKSchott commented 7 years ago

Okay, thanks for responding with that info. I'll look into this when I can prioritize the time.

jogibear9988 commented 6 years ago

Any news to this?

christophe-g commented 6 years ago

For the time being - submitted a PR to skip problematic js files here : https://github.com/Polymer/polymer-cli/pull/878.

Try it out by adding jQuery in the list of files to skip.

jogibear9988 commented 6 years ago

this is now fixed in my babel minfy patch: https://github.com/babel/minify/pull/733

I put a suggestion how to use while babel minify is not updated (and polymer cli also not) here: https://github.com/Polymer/polymer-cli/issues/886

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.