Skip to content

Replace uglifier with terser as the JS compressor#83

Merged
JuanVqz merged 1 commit into
mainfrom
chore/replace-uglifier-terser
Jul 9, 2026
Merged

Replace uglifier with terser as the JS compressor#83
JuanVqz merged 1 commit into
mainfrom
chore/replace-uglifier-terser

Conversation

@JuanVqz

@JuanVqz JuanVqz commented Jul 9, 2026

Copy link
Copy Markdown
Member

What

Replaces uglifier with terser as the JavaScript compressor.

Why

uglifier is ES5-only (it can't parse modern ES6+ syntax) and is effectively legacy. terser is 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:terser
  • Refreshed two comments (config/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.
  • Both Gemfile.lock and the dual-boot Gemfile.next.lock updated

Verification (local)

  • Boots
  • Production assets:precompile succeeds with terser minifying application.js (exercises the actual js_compressor = :terser path, not just dev compilation)
  • Test suite: 16 runs, 52 assertions, 0 failures, 0 errors, 0 skips
  • rubocop clean (exact CI config .rubocop_with_todo.yml)
  • reek clean (0 warnings)

@JuanVqz JuanVqz self-assigned this Jul 9, 2026
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.
@JuanVqz JuanVqz force-pushed the chore/replace-uglifier-terser branch from 7f54369 to e465946 Compare July 9, 2026 05:00
@JuanVqz JuanVqz marked this pull request as ready for review July 9, 2026 05:08
@JuanVqz JuanVqz merged commit 4a70e7b into main Jul 9, 2026
2 checks passed
@JuanVqz JuanVqz deleted the chore/replace-uglifier-terser branch July 9, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant