question

Alaa Adel avatar image
Alaa Adel asked

JS SDK bug preventing minifying the script

Hello,

I am using JS SDK. I was trying to minify the script using a service that uses Google Closure for that.

It showed an error regarding line 55 (same error for many files of the SDK source code):

xhr.setRequestHeader(gHeaderKey, headersObj[headerKey]);

It says that

gHeaderKey

is not defined. So I turned it to

"gHeaderKey"

And it was able to minify and works (for now..)

There are other occurrences of

setRequestHeader

but they use string parameters, so there were no problems with those.

So (if possible) please use string parameters because they are more robust for these cases.

Thank you.

sdks
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Alaa Adel avatar image Alaa Adel commented ·

Google's Closure Compiler

0 Likes 0 ·
Alaa Adel avatar image Alaa Adel commented ·

it says gHeaderKey is not declared*

0 Likes 0 ·

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

I tried to reproduce it using the latest closure compiler: https://mvnrepository.com/artifact/com.google.javascript/closure-compiler/v20210302 against the latest PlayFabClientApi.js file, following this tutorial: https://developers.google.com/closure/compiler/docs/gettingstarted_app. However, I cannot reproduce this issue because it successfully compiler the code without any errors:

May I know which steps did you take that leads to this error? Please share more details. Thanks!


1.png (6.4 KiB)
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Alaa Adel avatar image Alaa Adel commented ·

Thank you. I was using the script in Construct 3 engine. Then exported to HTML5 and selected Advanced minification.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.