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): support js template without child compiler #7704

Merged
merged 5 commits into from
Aug 28, 2024

Conversation

LingyuCoder
Copy link
Contributor

@LingyuCoder LingyuCoder commented Aug 27, 2024

Summary

Part of #7588

HtmlWebpackPlugin use child compiler to support functional template and template with loaders. In HtmlRspackPlugin, send data from rust to js and eval string in vm will lead huge performance regression in child compiler. So just support functional template here, if you need to use a template with loaders, you should compile it with child compiler in the function by yourself, or just use the HtmlWebpackPlugin.

  • Support function in templateContent or an exported function from .js/.cjs file path in template, the template parameters will be its argument and it should return a string which will be used as the html content.
    • In functional template content, the compilation object can also be visited from template parameters, which is not able to be visited in template string.
  • Support functional templateParameters, which will be used to customize the template parameters object.

Checklist

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

@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: feature release: feature related release(mr only) labels Aug 27, 2024
@LingyuCoder LingyuCoder changed the title feat(html): improve template parameters feat(html): support js template without child compiler Aug 27, 2024
@LingyuCoder LingyuCoder force-pushed the feat/support-js-template branch 2 times, most recently from 7f584d5 to a4bf286 Compare August 28, 2024 08:39
Base automatically changed from feat/improve-template-parameters to main August 28, 2024 08:47
@LingyuCoder LingyuCoder force-pushed the feat/support-js-template branch from a4bf286 to 58ee925 Compare August 28, 2024 09:04
Copy link

netlify bot commented Aug 28, 2024

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 58ee925
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/66cee81245dc3800081a9904

@web-infra-dev web-infra-dev deleted a comment from github-actions bot Aug 28, 2024
@LingyuCoder LingyuCoder marked this pull request as ready for review August 28, 2024 09:33
@LingyuCoder LingyuCoder requested a review from ahabhgk August 28, 2024 09:33
@LingyuCoder LingyuCoder merged commit dc30af1 into main Aug 28, 2024
37 checks passed
@LingyuCoder LingyuCoder deleted the feat/support-js-template branch August 28, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants