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(html): include innerHTML content in rendered asset tags #9526

Merged

Conversation

faultyserver
Copy link
Contributor

Summary

I was trying to implement an HtmlRspackPlugin addition using the alterAssetTags hook, and for my use case I needed to set innerHTML on the generated tag (to get something like <script>console.log("Hello")</script>). After a lot of confusion about why things weren't showing up as I expected and instead got empty tags, I went to look at the implementation and found that HtmlPluginTag was always setting children to an empty vector.

This PR fixes that to render the innerHTML property of the tag there as a plain Text node if it's present. I also tried to add an end to end test for this, but wasn't able to get them running locally immediately, so hopefully CI will indicate if it's correct, otherwise I'll get them set up and running to try it out.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Sorry, something went wrong.

@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Mar 3, 2025
Copy link

netlify bot commented Mar 3, 2025

Deploy Preview for rspack canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 13e3a2b
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/67c4fad176eb670008cd1e68

@faultyserver faultyserver force-pushed the fauly/html-plugin-inner-html branch from 47d52ba to 81b9376 Compare March 3, 2025 00:37
@faultyserver faultyserver force-pushed the fauly/html-plugin-inner-html branch from 81b9376 to 13e3a2b Compare March 3, 2025 00:41
Copy link

codspeed-hq bot commented Mar 3, 2025

CodSpeed Performance Report

Merging #9526 will not alter performance

Comparing faultyserver:fauly/html-plugin-inner-html (13e3a2b) with main (832bc69)

Summary

✅ 7 untouched benchmarks

Copy link
Contributor

@LingyuCoder LingyuCoder left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@LingyuCoder LingyuCoder merged commit 3c7a436 into web-infra-dev:main Mar 4, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: bug fix release: bug related release(mr only)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants