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(html): builtins.html should inject <script src="xxxx.js" /> in <head /> #2770

Merged
merged 2 commits into from
Apr 16, 2023

Conversation

suxin2017
Copy link
Collaborator

@suxin2017 suxin2017 commented Apr 16, 2023

Summary

Fixes #2768

🤖 Generated by Copilot at c645a9e

This pull request changes the default behavior of the rspack_plugin_html crate to inject script tags into the head element of the HTML output instead of the body element. This improves performance and avoids duplication of scripts in some cases. It also adds a feature to allow users to customize the filename of the output file using a content hash. It updates the test cases and expected outputs to match the new behavior and feature.

Related issue (if exists)

Walkthrough

🤖 Generated by Copilot at c645a9e

  • Change the default injection point of script tags from body to head (link)
  • Update the expected outputs of various test cases to match the new injection point (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Remove the redundant script tags from the body element of some test cases (link, link, link, link, link)
  • Add a new expected output file for the filename test case that uses a content hash as part of the file name (default.cf6dd0ecc5222c7a.html) (link)
  • Delete the old expected output file for the filename test case that had a different content hash (default.c58a17e264b8bc1.html) (link)
  • Interpolate the title tag with the template parameter foo in the template+templateParameters test case (link)
  • Interpolate the template content with the template parameter bar in the templateContent+templateParameters test case (link)
  • Set the title tag to the value of the title option in the title test case (link)

@changeset-bot
Copy link

changeset-bot bot commented Apr 16, 2023

⚠️ No Changeset found

Latest commit: 7706ecd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@suxin2017 suxin2017 marked this pull request as ready for review April 16, 2023 13:50
@suxin2017 suxin2017 requested a review from ahabhgk as a code owner April 16, 2023 13:50
@hyf0 hyf0 self-assigned this Apr 16, 2023
@hyf0 hyf0 changed the title fix(html): builtins.html should inject <script href="xxxx" /> in <head></head> fix(html): builtins.html should inject <script href="xxxx" /> in <head /> Apr 16, 2023
@hyf0 hyf0 changed the title fix(html): builtins.html should inject <script href="xxxx" /> in <head /> feat(html): builtins.html should inject <script href="xxxx" /> in <head /> Apr 16, 2023
Copy link
Collaborator

@hyf0 hyf0 left a comment

Choose a reason for hiding this comment

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

I didn't expect the enhancement comes so fast. You are wonderful.

@hyf0 hyf0 added this pull request to the merge queue Apr 16, 2023
@hyf0 hyf0 added this to the Next patch - 0.1.X milestone Apr 16, 2023
Merged via the queue into web-infra-dev:main with commit 094c379 Apr 16, 2023
12 checks passed
@hyf0 hyf0 changed the title feat(html): builtins.html should inject <script href="xxxx" /> in <head /> feat(html): builtins.html should inject <script src="xxxx.js" /> in <head /> Apr 16, 2023
siyou pushed a commit to siyou/rspack that referenced this pull request May 14, 2023
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.

builtins.html should inject <script href="xxxx" /> in <head></head>
3 participants