Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polymer-bundler v3.1.1 fails to inline script with empty getter function #775

Closed
freshp86 opened this issue Oct 31, 2018 · 7 comments
Closed
Assignees
Labels

Comments

@freshp86
Copy link

bug.html file

<script src="bug.js"></script>

bug.js file

class Foo {
  get foo() {}
}

Polymer bundler command (version 3.1.1)

./node_modules/polymer-bundler/lib/bin/polymer-bundler.js --in-html bug.html --inline-scripts --manifest-out manifest.json

The command above returns the contents of the original HTML file without inlining the JS file. The contents of the manifest indicate that something went wrong.

{"bug.html":["bug.html"],"_missing":["bug.js"]}

Apparently polymer-bundler failed to find the JS file, which seems very odd.

If get foo() {} is changed to have some contents, like

get foo {
  console.log('foo');
}

The problem no longer happens, and the script is inlined as expected.

@freshp86
Copy link
Author

freshp86 commented Oct 31, 2018

cc @azakus @usergenic. This was discovered at https://chromium-review.googlesource.com/c/chromium/src/+/1309223 by @rbp314.

@usergenic
Copy link
Contributor

Interesting... i wonder if our JS parser in the analyzer broke trying to read it with empty body and/or if this is an issue with latest package versions. Thanks for the heads up @freshp86 - I'll add a regression test for this case and see where it leads.

@usergenic usergenic self-assigned this Oct 31, 2018
@usergenic
Copy link
Contributor

Note Bundler is now part of https://github.com/Polymer/tools so I'll transfer this issue over there.

@usergenic usergenic transferred this issue from Polymer/polymer-bundler Oct 31, 2018
@moderndeveloperllc
Copy link
Contributor

@usergenic Issue with dead code removal? Just a thought. Seen lots of those floating around babel repos lately for some reason.

@usergenic
Copy link
Contributor

@moderndeveloperllc makes a lot of sense assuming the dead-code removal occurs prior to bundling. Verifying...

@stale
Copy link

stale bot commented Mar 4, 2020

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.

@stale stale bot added the wontfix label Mar 4, 2020
@stale
Copy link

stale bot commented Apr 29, 2022

This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!

@stale stale bot closed this as completed Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants