Replace uglifier with terser as the JS compressor#83
Merged
Conversation
uglifier is ES5-only and unmaintained-adjacent; terser is the maintained, ES6-capable drop-in used by modern Rails. Swapped the gem and set config.assets.js_compressor = :terser. Also refreshed two comments that blamed Uglifier's ES5 parser for excluding ActiveStorage/ActionCable/ActionText JS from precompile: those exclusions stay (that JS is genuinely unused here -- Paperclip handles uploads, no ActionText), but the rationale is now simply 'unused', not a compressor limitation. Verified locally: boots, production assets:precompile succeeds with terser minifying application.js, test suite green (16 runs, 52 assertions, 0 failures), rubocop clean (exact CI config), reek clean.
7f54369 to
e465946
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces
uglifierwithterseras the JavaScript compressor.Why
uglifieris ES5-only (it can't parse modern ES6+ syntax) and is effectively legacy.terseris the maintained, ES6-capable drop-in that modern Rails uses. The ES5 limitation had already forced workarounds in this app (excluding ActiveStorage/ActionCable/ActionText JS from precompile).Changes
Gemfile:gem "uglifier"→gem "terser"(1.2.8)config/environments/production.rb:config.assets.js_compressor = :uglifier→:terserconfig/application.rb,config/initializers/assets.rb) that blamed Uglifier's ES5 parser for the precompile exclusions. The exclusions stay — that JS is genuinely unused here (uploads go through Paperclip, no ActionText) — but the rationale is now simply "unused," not a compressor limitation.Gemfile.lockand the dual-bootGemfile.next.lockupdatedVerification (local)
assets:precompilesucceeds with terser minifyingapplication.js(exercises the actualjs_compressor = :terserpath, not just dev compilation)rubocopclean (exact CI config.rubocop_with_todo.yml)reekclean (0 warnings)