Error when exporting with minify script

For developers using the Construct 2 Javascript SDK

Post » Tue Nov 05, 2013 9:02 pm

Hi everyone,

Looking for help here!

I am working on a plugin for connecting C2 to an ASP.NET SignalR server code. (http://www.asp.net/signalr/overview/signalr-20)

I have included all SignalR JavaScript code required in the plugin. It also required jQuery in order to work correctly.

Everything works fine in preview mode and when the JavaScript is not minify, see here:
http://signalr.progistic.com/fridaynight/index.html

I do have and an error as soon as I minify the JavaScript when exporting. It complains that jQuery was not found:
http://signalr.progistic.com/fridaynight_mini/index.html

Is there something I need to do in my plugin to ensure jQuery is present?

Thanks for your help.
B
19
S
5
G
5
Posts: 51
Reputation: 4,849

Post » Tue Nov 05, 2013 11:19 pm

I want to add on to this.

I am also developing a plugin for JWebSockets.

I have the same problem.

When I minify the script during export, I get errors.
I have also investigated this in detail, and I found that by minifying, some of the JavaScript identifiers were changed.

For example, one of the identifer was "usersList" and it was changed to "-"

At present I am developing the plugin so testing without minify is ok. But it will be a problem when I want to actually deploy it.
B
3
Posts: 6
Reputation: 187

Post » Wed Nov 06, 2013 9:09 pm

@shashankthebest

instead of "usersList" try to use ["userList"]. Then, the minifyer won't change the identifier.


@IronRick

Try with including the unminifed version of the SignalR library, not sure what's going on when you minify stuff twice, but i'm sure it's not helping.

Also, i would check if it helps if you're refecencing jquery with "jQuery." instead of "$." in your connect action.JohnnySheffield2013-11-06 21:18:36
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,662

Post » Wed Nov 06, 2013 9:19 pm

Minified scripts are passed through Google Closure Compiler's advanced mode. It's covered in the SDK documentation.
Scirra Founder
B
387
S
230
G
88
Posts: 24,251
Reputation: 192,454

Post » Thu Nov 07, 2013 2:26 pm

Thank you both for your help.

I will take a look closely at my code and the SignalR library to ensure I always use the dot syntax and the "jQuery." instead of "$.".
B
19
S
5
G
5
Posts: 51
Reputation: 4,849

Post » Fri Nov 08, 2013 8:59 pm

I did try with the un-minifed version of the SignalR library but I still got the same error.

The good news is that SignalR will remove the jQuery dependency on their next release version. I guess I will wait until then to re-try minifying my plug-in.
B
19
S
5
G
5
Posts: 51
Reputation: 4,849


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests