Open CheariX opened 2 months ago
I found this issue on uglifier:
https://github.com/lautis/uglifier/issues/174#issuecomment-1054463562
@george-gca: should we maybe also switch from uglifier to terser?
I'm currently running into the following error when building al-folio with JEKYLL_ENV=production bundle exec jekyll build --trace
:
/usr/lib/python3/dist-packages/nbconvert/filters/highlight.py:170: UserWarning: IPython3 lexer unavailable, falling back on Python 3
warn("IPython3 lexer unavailable, falling back on Python 3")
bundler: failed to load command: jekyll (/usr/local/rvm/gems/default/bin/jekyll)
/usr/local/rvm/gems/default/gems/uglifier-4.2.0/lib/uglifier.rb:291:in `parse_result': Unexpected token: punc (.) (Uglifier::Error)
--
41 CSS.highlights.set(customHighlightName, highlight);
42 };
43
44 const getTextNodesInElementContainingText = (element, text) => {
45 const nodes = [];
46 const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
47 let node;
48 while ((node = walker.nextNode())) {
=> if (node.textContent?.toLowerCase().includes(text)) {
50 nodes.push(node);
51 }
52 }
53 return nodes;
54 };
55
56 const getRangesForSearchTermInElement = (element, search) => {
57 const ranges = [];
==
from /usr/local/rvm/gems/default/gems/uglifier-4.2.0/lib/uglifier.rb:221:in `run_uglifyjs'
from /usr/local/rvm/gems/default/gems/uglifier-4.2.0/lib/uglifier.rb:166:in `compile'
from /usr/local/rvm/gems/default/gems/jekyll-minifier-0.1.10/lib/jekyll-minifier.rb:102:in `output_js'
from /usr/local/rvm/gems/default/gems/jekyll-minifier-0.1.10/lib/jekyll-minifier.rb:210:in `write'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/site.rb:231:in `block in write'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/site.rb:364:in `block in each_site_file'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/site.rb:364:in `each'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/site.rb:364:in `each_site_file'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/site.rb:230:in `write'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/site.rb:82:in `process'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/command.rb:28:in `process_site'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:65:in `build'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:36:in `process'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `each'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
from /usr/local/rvm/gems/default/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from /usr/local/rvm/gems/default/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from /usr/local/rvm/gems/default/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from /usr/local/rvm/gems/default/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from /usr/local/rvm/gems/default/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from /usr/local/rvm/gems/default/gems/jekyll-4.3.3/exe/jekyll:15:in `<top (required)>'
from /usr/local/rvm/gems/default/bin/jekyll:25:in `load'
from /usr/local/rvm/gems/default/bin/jekyll:25:in `<top (required)>'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/cli/exec.rb:58:in `load'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/cli/exec.rb:23:in `run'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/cli.rb:451:in `exec'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/cli.rb:34:in `dispatch'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/cli.rb:28:in `start'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/exe/bundle:28:in `block in <top (required)>'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /usr/local/rvm/gems/default/gems/bundler-2.5.7/exe/bundle:20:in `<top (required)>'
from /usr/local/rvm/gems/default/bin/bundle:25:in `load'
from /usr/local/rvm/gems/default/bin/bundle:25:in `<main>'
I do not understand the reason for this. It seems, that something is "optimizing" the code in https://github.com/alshedivat/al-folio/blob/49ada3eac1ef52229e550c98826f05f1c3d70078/assets/js/highlight-search-term.js#L86 to the ES6 optimized variant node.textContent?.toLowerCase().includes(text)
.
It only happen with JEKYLL_ENV=production
. Without that, deployment is fine,
We only use uglifier because of jekyll-minifier. Maybe if terser-ruby gives the same features we could migrate to it. It is even recommended by it if we want to support ES6.
Edit: supposedly we were already supporting ES6 with:
jekyll-minifier:
uglifier_args:
harmony: true
As stated in its README.
The ES6 support in uglifier is experimental. It obviously has some bugs, such as https://github.com/lautis/uglifier/issues/174
Have you checked that your feature request isn't already filed?
Description & Motivation
Uglifier currently fails when ES6 synatax is used. See e.g. https://github.com/alshedivat/al-folio/actions/runs/9649917821/job/26614403326#step:5:363 in #2523.
Pitch
Uglifier should support ES6 syntax to allow better code quality, i.e. easier to read, less to write.
Alternatives
No response
Additional context
No response