Skip to content

fix: regexp match script tag ignore comment #20341

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 3 commits into
base: main
Choose a base branch
from

Conversation

btea
Copy link
Collaborator

@btea btea commented Jul 3, 2025

Description

fix #20340

Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

I don't think stripLiteral works with HTML files.
Maybe we can use parse5.Tokenizer to do something similar to stripLiteral but I'm not sure if that is performant than parsing + traversing the HTML directly.

@btea
Copy link
Collaborator Author

btea commented Jul 3, 2025

You are right. The local test result was correct by accident. The type value in the script tag was removed, resulting in the regular expression not matching.

Can we add another regular expression to match the comment content in HTML? 🤔

@sapphi-red
Copy link
Member

I guess we need to at least tokenize it to properly handle comments. In other words, I don't think regex is sufficient.

@btea btea requested a review from sapphi-red July 6, 2025 01:30
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.

Commented-out importmap is uncommented during build
2 participants