Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect babel retainLines option. #205

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dan-tailormed
Copy link

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.

@stefanpenner
Copy link
Member

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

@rwjblue
Copy link
Member

rwjblue commented May 22, 2018

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

@dan-tailormed
Copy link
Author

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

@arthur5005
Copy link

arthur5005 commented Aug 28, 2020

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.

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.

4 participants