Any babel plugin to remove unnecessary assignment?

59 Views Asked by At

I am trying to optimize my bundle and I want to transform code from this:

  const tmp = '1'
  obj['a'] = tmp
  str += tmp

to this:

  let str = ''
  const obj = {}
  str += obj['a'] = '1' 

Is there any babel plugin for this kind of transformation? Or would it be handled by minifier like Terser?

0

There are 0 best solutions below