Moving install/jslim elsewhere and running it results failure
Closed this issue · 4 comments
I wanted to copy the build/install/jslim
directory closer to my project where I could run it with command
jslim/bin/jslim --js_output_file out.js --js main.js --lib_js jquery.js
But instead I am getting the failure:
java.lang.NullPointerException
at com.grossbart.jslim.JSlim.getFunctionNames(JSlim.java:1027)
at com.grossbart.jslim.JSlim.getFunctionNames(JSlim.java:1032)
at com.grossbart.jslim.JSlim.getFunctionNames(JSlim.java:1032)
at com.grossbart.jslim.JSlim.findMatchingFunctions(JSlim.java:1122)
at com.grossbart.jslim.JSlim.findKeepers(JSlim.java:888)
at com.grossbart.jslim.JSlim.pruneTree(JSlim.java:726)
at com.grossbart.jslim.JSlim.slim(JSlim.java:281)
at com.grossbart.jslim.JSlim.addLib(JSlim.java:148)
at com.grossbart.jslim.JSlim.prune(JSlim.java:180)
at com.grossbart.jslim.JSlimRunner.prune(JSlimRunner.java:340)
at com.grossbart.jslim.JSlimRunner.main(JSlimRunner.java:478)
Hi. I'm sorry I didn't see this issue for a while. Are you still having trouble? Any updates?
Thanks,
Zack
Same thing still occurs.
This error doesn't look like it's related to moving the project. The error indicates that you have an invalid assignment operator in one of your JavaScript files and we're not handling it well. I've made a change in revision e069d29 which should avoid this error and skip this assignment operator. However, this change may cause JSlim to remove a function it should keep because it can't understand the assignment operator.
There's one of two things going on here: either you have some invalid JavaScript where you're assigning a variable to an invalid expression or you have some syntax that JSlim hasn't encountered yet. If you know what the syntax is that's causing the problem I'd be very curious to see it and maybe add a unit test for it.
Thanks,
Zack
Thank you for the fix.
It seems that it is triggered by jQuery, http://code.jquery.com/jquery-2.0.3.js, but cannot say which exact line...