-
Notifications
You must be signed in to change notification settings - Fork 97
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
Bug - Corrupted CommonJS in js-cache #6
Comments
Hi @faf we update the CKEditor right up to 4.16.0 because they released a new security release, yesterday sigh For further reference: From now on we changed this on the QA stage. Thank you for your help ❤️ Спасибо за вашу помощь :) |
I'm almost sure that it's a bug in JavaScript::Minifier. More over ckeditor.js is already minified out of the box. There is no sense to do it twicely. The simplest bug fix would be to ignore the minification stage. |
Opened a bug for JavaScript::Minifier package zoffixznet/JavaScript-Minifier#10. |
Thank your for your help. We really appreciate this. |
Just a note: I inherited this codebase to be sort of a janitor. I've no idea how the code works, so unfortunately, can't provide the fix. Can only apply and upload one if someone is kind enough to provide it. Sorry. |
Seems like it's possible to fix this particular issue in minifier, but it looks like there could be more problems there. Maybe one should switch to JavaScript::Minifier::XS or some other minifier instead. |
I've merged the fix faf submitted (thank you) and pushed updated module to CPAN.
That's my recommendation as well. I believe JavaScript::Minifier::XS or something similar is used as an optional dependency by Mojolicious::Plugin::Webpack and Mojolicious::Plugin::AssetPack. I've used Mojolicious::Plugin::AssetPack with a ton of JS files and never had any issues, so whatever it uses under the hood to minify should be fairly solid. |
Thank you all very much for your support. Both solutions work fine for us (JavaScript::Minifier 1.15 and JavaScript::Minifier::XS). The next release of Znuny will contain the updated version 1.15 of JavaScript::Minifier and will optionally automatically utilize JavaScript::Minifier::XS instead if it is installed. Same will be the case btw. for CSS::Minifier and CSS::Minifier::XS. |
…f JavaScript::Minifier::XS if available. Thanks to Fedor A. Fetisov (@faf), @zoffixznet and Yuri Myasoedov (@ymyasoedov). See #6.
Expected behavior
All JS working as intended.
Actual behavior
Syntax error making JS dysfunctional.
How to reproduce
Steps to reproduce the behavior:
Uncaught SyntaxError: missing ) after argument list
in CommonJS.Environment
Additional information
The problem occurs because of CKEditor, namely because of this line. Seems like during the generation of combined js-file everything after the double slashes and before the line break is treated as comment and is ignored.
The quick solution is to manually fix ckeditor.js by escaping double slashes, so
indexOf("file://")
becomesindexOf("file:\/\/")
. But I'm not sure whether it's the correct way.The text was updated successfully, but these errors were encountered: