-
Notifications
You must be signed in to change notification settings - Fork 201
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
js minify breaks polymerfire #2420
Comments
Additional info:
C |
workaround (ugly!): add smth that breaks babili at the top of a file that should not be minified For example adding the snippet below at the top of firebase-database.js makes my minified app work again (the build will complain with (function(){
new RegExp("^([A-Za-z0-9_\-\.])+\@$");
}) Interested in better ways to do this of course ... |
Ugh, this is probably related to https://github.com/Polymer/polymer-cli/issues/689. We've talked about adding a configurable "skip optimization" option, but atm our effort may be better spent on fixing the minify bug in babili for everyone. |
Looks like we have a fix here: Polymer/polymer-cli#698 |
@FredKSchott that would be too easy, The fix #698 does not work here - something else seem to be happening. I did not have time to trace down this issue and find the root cause. Good luck ! |
I also found --js-minify breaks the polymerfire in the build process. Error reported when firebase-auth called: |
this issue still persist. Just copy JS file that your project need and replace minified Firebase files in your build as workaround (not fancy) for unbundled builds. Otherwise use polymer-build for custom configuration and exclude Firebase from being re minified |
I'm curious on the status of this issue because it appears that the minification of polymerfire causes Firebase Cloud Messaging calls (using curl) to return: {"multicast_id":5746259717406816060,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidParameters"}]} But if we turn off minification when we do a "polymer build", everything works fine. |
@Guild-Master. Issue is still hitting my build process under v1.1.0. |
With v1.1.0, I get |
I also see this problem with polymer cli v1.1.0 and after updating to polymerfire v2.1.0
|
Even though this is a problem with the minifier, wouldn't it be good to be able to not minify certain scripts, especially when you have 3rd party redistributable scripts with a version and a license like in the Firebase scripts? |
Same With v1.2.0, I get |
Also getting this error on v1.2.0 -- just brought our production build to a halt.
@christophe-g's fix doesn't seem to work for us, nor does building with the following flags:
Which is odd, because I thought this problem was related to minification. |
Hey @eob In my case it was the HTML minification. Maybe this is a mix of other problems. |
Seeing this on v1.3.1 as well. |
Update? |
I was getting the |
@christophe-g's suggestion gave me an error "Invalid Regular Expression" in the console, and then a firebase.auth is not a function error, probably because of the first error. Is there another recommended way to fix this? Turning off JS minify seems like a poor solution. |
@aswerdlow935 Maybe try to also add same |
I am getting the same error using "google" as the provider of security. Here is the authentication code I am using.
I get the same error report with Uncaught TypeError: Cannot read property 'length' of undefined Interestingly I get a blank sign-up box as well. |
I am getting exactly the same error as @homerjonathan when trying to log in with Google using polymerfire after building with Uncaught TypeError: Cannot read property 'length' of undefined
at Us.o.dispatchEvent (my-app.html:16)
at Hs (my-app.html:16)
at Us.Ke (my-app.html:16)
at Us.send (my-app.html:16)
at Yl.qg (my-app.html:16)
at tu (my-app.html:16)
at my-app.html:16
at new Ir (my-app.html:16)
at ru (my-app.html:16)
at my-app.html:16 |
This is my temporary fix... to [install_dir]/polymer-cli/lib/build/optimize-streams.js --- optimize-streams.js.orig 2017-08-30 17:40:02.654992031 +0900
+++ optimize-streams.js 2017-08-30 17:43:42.132991921 +0900
@@ -50,6 +50,13 @@
return;
}
+ if(/firebase-auth\.js$/.test(file.path) &&
+ this.optimizerOptions.presets[0].minified == true){
+ logger.warn('skip minify `firebase-auth.js` ...');
+ callback(null, file);
+ return;
+ }
+
if (file.contents) {
try {
let contents = file.contents.toString(); |
There is now a PR for skipping minification of problematic js files: Polymer/polymer-cli#878 |
My workaround is to skip polymerfire entirely:
|
I'm having the same problem.
Everything was updated and tested with the newest versions: |
Is it fixed? |
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. |
Description
building with
"js": { "minify": true }
breaks polymerfire. Cannot read the database anymore and get error messages like:FIREBASE INTERNAL ERROR: Server Error: ClientId[7309775]:ErrorId[966]: Error on incoming message
.Just replacing the files in
build/min/bower_components/firebase/
by original files (firebase-app.js, firebase-database.js, firebas-auth.js ... which are already minified) makes the app work again.As an - unsuccessful - workaround, I tried to upgrade babel-preset-babili to the latest version (0.0.12), and unset all babel-preset-options (
{boolean: false, buildIn, false, ...}
as in Polymer/polymer-cli#698).Is there a way to prevent some files to be minified during the build process?
Versions & Environment
The text was updated successfully, but these errors were encountered: