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

fix: avoid source map plugin from replacing valid code #30890

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

Conversation

JonathanWbn
Copy link

Additional details

The regex condition to find source map links would catch code that wasn't actually a source map link, but only looked like it.

A real source map link would always look like this: //# sourceMappingURL=a-real-file-path.js

So I decided to refine the regex to ensure it doesn't match if there is a ' or " after the =. Because valid source map URL's won't have these quotes, but these edge cases where this snippet is part of the code will have it.

Steps to test

The broken behaviour can be reproduced by importing a JS file that looks like a source map link, but isn't actually one, e.g.:

console.log("//# sourceMappingURL=")

How has the user experience changed?

There are no changes to the user experience, but some edge cases that previously would break will no longer break.

PR Tasks

@CLAassistant
Copy link

CLAassistant commented Jan 16, 2025

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link
Collaborator

@jennifer-shehane
Copy link
Member

@JonathanWbn Thanks for the contribution! Could you please sign our CLA?

@jennifer-shehane
Copy link
Member

Rerunning since I think those failures may have been 14.0 related

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.

Sourcemap plugin breaks JS files
5 participants