Closed throwaway-a closed 3 years ago
Many thanks for reporting this, it's scary... There is apparently a bug in the minification program used by jsdelivr (same for cdnjs) when transforming brython.js
to brython.min.js
.
Until the bug is fixed, the best is to use brython.js
. I have modified the README accordingly.
The difference in size of the compressed files is only 20 kB.
Hi, Martin from jsDelivr here. It really seems like a terser issue. If you'd like to get it fixed, I suggest reporting it at their issue tracker. I'm not familiar enough with brython to help in that regard but if a fix is released, I'll make sure we deploy it quickly.
Thanks Martin for the fast reaction.
I think I have found the code in Brython that causes the minification error. I will publish a new Brython release tomorrow and I will report an issue on the Terser tracker.
I have just released version 3.10.3, after installing terser locally (version 5.9.0) and testing that all the tests in Brython test suite pass with the version of brython.min.js produced by terser.
Unfortunately, the version generated by jsDelivr from brython.js, while loading without error this time, does not pass all the tests...
This is really annoying. @MartinKolarik, it is possible that jsDelivr makes brython.min.js the same as brython.js until this issue is solved ?
For the next releases, should I include the version of brython.min.js that I can test locally in the npm package, or would it be erased by the one generated by jsDelivr scripts ?
You can certainly ship your own min file and we'll use it without any modification in that case. I'll also try to update our terser to 5.9 today.
We replaced the 3.10.3 file by a version built with Terser v5.9.0.
Thanks Martin. The version produced by v5.9.0 has the same issue as with 5.7.1, and I am almost sure I know why. In a few words: Brython generates a set of Javascript functions based on a template function with code like
function f(){
// placeholder
...
}
other_function = (f + '').replace('// placeholder', <some code>)
The problem is that the minifier changes the source code of function f()
and the line // placeholder
is removed...
I have changed this code to avoid the issue. If possible I would like to avoid releasing another version ; if I send you a working version of brython.min.js
can you put it on the CDN server ?
@PierreQuentel I see, that's definitely a problem for the typical minifier setup. I think for the next versions, it'll be best if you ship your own minified version. For 3.10.3 if you send me a fixed version, I can replace it.
@MartinKolarik I have sent it by email. Thanks for your help !
@PierreQuentel did you send it to the address in my GH profile? Don't see anything from you. Maybe push it to a branch in this repo?
Yes, I sent it at this address, and didn't get a non-delivery notification. It seems that someone up above put a spell on this release :-)
I have pushed it to this repo at www/src/brython.min.js.
Ok, it should finally work now.
Yes, apparently everything works now !
@throwaway-a can you confirm and close the issue if it is the case ?
I am closing the issue. @throwaway-a don't hesitate to reopen it if appropriate.
I've got multiple people saying they can't use my code which depends on Brython. It imports it via:
The error, from inspector console view in Chrome