ember-cli-babel icon indicating copy to clipboard operation
ember-cli-babel copied to clipboard

Respect babel retainLines option.

Open dan-tailormed opened this issue 7 years ago • 4 comments

Hi,

While trying to set ember developing environment with vscode and vscode-debug-chrome extenstion I was facing some issues with setting breakpoints since they where offset in the source code.

I found that this setting allow for correct line mapping and by this solving this issue. I think that others might find this useful for their development as well.

dan-tailormed avatar Mar 03 '18 09:03 dan-tailormed

Any reason to not enable this all the time? "semi wacky code" may not be bad, as long as it isn't TOO BAD.

Areas of concern would be:

  • build speed
  • ??

cc @rwjblue

stefanpenner avatar May 22 '18 00:05 stefanpenner

What does the option actually do? Can you share some before / after code snippets (and likely sourcemaps)?

rwjblue avatar May 22 '18 00:05 rwjblue

Hey, Please see the following:

When using original current version of babel setting a breakpoint will not stop on the correct line

original-babel-set-bp

original-babel-stop-at-wrong-line

After installing the modified version that support retainLines

activate-retainline-in-ember-cli-build

set-bp-with-retainline-activated

stop-in-correct-line

Settings in launch.js file to support this

debug-for-chrome-launch-settings

@stefanpenner I do not notice any major build speed change

@rwjblue This addition to support retainLines is optional and can be controlled by the developer from ember-cli-build.js

If you will accept this PR I'm sure it can assist many developers and should be documented in the readme.

Thanks

dan-tailormed avatar Jun 26 '18 04:06 dan-tailormed

Wondering if there's any movement on this, running into line offset problems often while developing.

edit: Hmm after reading the description of the option, it doesn't feel like this will solve my issue. I'm running into sourcemap line offset issues.

Babel will make an effort to generate code such that items are printed on the same line that they were on in the original file. This option exists so that users who cannot use source maps can get vaguely useful error line numbers, but it is only a best-effort, and is not guaranteed in all cases with all plugins.

arthur5005 avatar Aug 28 '20 18:08 arthur5005