Skip to content

fix: this.outro need to be mapped #300

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

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

Conversation

hai-x
Copy link

@hai-x hai-x commented Jan 2, 2025

const s = new MagicString(
  'var answer = 42;\nconsole.log("the answer is %s", answer);'
)
s.append('\n\n\n\n}).call(global);')

Then s.toString().split('\n').length equals to 6, which means output has 6 lines.

So for its sourcemap, s.generateMap().mappings should also has 6 lines. But now it only has 2 lines.

Current output

AAAA;AACA

Expected output

AAAA;AACA;;;;

@antfu
Copy link
Collaborator

antfu commented Jan 2, 2025

Could you help to add a test to guard this from future regressions? Thanks

@hai-x hai-x force-pushed the fix-sourcemap-outro branch from d4ddee4 to 396ded6 Compare January 2, 2025 09:37
@hai-x
Copy link
Author

hai-x commented Jan 2, 2025

Could you help to add a test to guard this from future regressions? Thanks

@antfu Added. Could you please review it again?

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.

2 participants