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

feat: source-map using MagicString #46

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

Conversation

JannikGM
Copy link

Fixes misalignment of debugger statements etc. when using this plugin, which forced us back to Webpack.


Barely tested due to:

We'll probably migrate to another package which has a proper JS parser (instead of hacky regex), so I'm not sure how much time I'll invest into improving this PR.


const requireMatches = code.matchAll(requireRegex);
const requireMatches = ms.toString().matchAll(requireRegex);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These steps might not work correctly, because the modified string is being returned here, but replacements happen in the original string.

This should probably be improved, but I feel this code needs to be modified anyway (with a proper JS parser instead of regex).

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.

1 participant