uglifier icon indicating copy to clipboard operation
uglifier copied to clipboard

NoMethodError: undefined method `start_with?' for nil:NilClass

Open khoan opened this issue 4 years ago • 1 comments

$ bin/bam
Uglifier version 4.1.11
#<NoMethodError: undefined method `start_with?' for nil:NilClass>
fail :(

$ cat bin/bam
#!/usr/bin/env ruby

require 'uglifier'

puts "Uglifier version #{Uglifier::VERSION}"
uglifier = Uglifier.new(harmony: true)
begin
  uglifier.compile(<<~EOSCRIPT)
function bam(sam) {
  sam = Object.assign({}, {error: 'wat'});
  const { error } = sam;
}
  EOSCRIPT
  puts 'ok'
rescue => e
  puts e.inspect
  puts 'fail :('
end

Thanks.

khoan avatar Sep 04 '20 03:09 khoan

harmony support is experimental and there're old bugs

try https://github.com/ahorek/terser-ruby

Terser version 1.1.1
function bam(r){r=Object.assign({},{error:"wat"});const{error:n}=r}
ok

ahorek avatar Dec 08 '20 19:12 ahorek