babel: retainLines doesn't work with class-properties-transform

Given this input:

 class SourceMapTest {
   /* some comment */
   foo() {
     debugger;
   }
   bar() {
     alert(1);
   }
 }

“retainLines” produces correct output:

SourceMapTest.prototype.
foo=function(){'use strict';
debugger;
};SourceMapTest.prototype.
bar=function(){'use strict';
alert(1);
};function SourceMapTest(){'use strict';}

However, with “class-properties-transform”, “retainLines” no longer works correctly:

class SourceMapTest {
 /* some comment */
 foo() {
   debugger;
 }
 bar = function() {
    alert(1);
  };
}
function SourceMapTest(){'use strict';this.





bar=function(){
alert(1);
};}SourceMapTest.prototype.foo=function(){'use strict';debugger;};

Notice that foo is not at the correct line.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Please in the future file bugs for cases you run across. We can’t know that there are sourcemap issues if you don’t give us examples.

I think I was convinced above to stand down from trying to remove it for now. It’s not code I love, but I was under the mistaken impression that people only used it for tooling that didn’t have sourcemap support, rather than day-to-day dev.

That said, it absolutely does have low priority, so while I’ll certainly take PRs that try to make it work better without compromising other functionality, it is unlikely that we’d get to those fixes ourselves.