Skip to content

fix(app-tools): scope async HTML scripts to streaming entries - #9033

Merged
GiveMe-A-Name merged 3 commits into
web-infra-dev:mainfrom
byte-lyh:fix/html-async-chunks-by-entry
Oct 21, 2026
Merged

GiveMe-A-Name merged 3 commits into
web-infra-dev:mainfrom
byte-lyh:fix/html-async-chunks-by-entry

Conversation

@byte-lyh

@byte-lyh byte-lyh commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

在同一应用中混用 streaming SSR、string SSR 和 CSR 时,只要一个入口开启 streaming SSR,HtmlAsyncChunkPlugin 就会把其他入口的 defer 脚本也改为 async,并改变脚本插入位置。这会导致非 streaming 页面错过 DOMContentLoaded 回调,或在 head 中的 deferred SDK 执行前运行业务代码。

本次按 HTML 所属的 entryName 判断是否应用 streaming 脚本处理,使用已有的 getEntryOptions 解析全局配置、入口覆盖和主入口的 package-name 别名。CSR/string SSR 保留原有执行顺序及 html.inject 配置,streaming SSR 和全局 RSC 保留现有行为。

新增独立的三入口应用集成测试,覆盖 native/JS HTML 插件、独立/合并 runtime、产物布局、延迟入口脚本、延迟 SDK,以及页面交互。同时补充入口配置与 HTML hook 单测和 patch changeset。

Validation

  • 上游 main(6a891f027)运行新增的 28 项集成测试:24 项失败、4 项通过。失败为 CSR/string SSR 的布局和脚本时序断言,4 项 streaming 布局用例通过。
  • 修复后同一组集成测试:28 项全部通过,无跳过。
  • @modern-js/app-tools 单测:132 项通过。
  • 现有 streaming-runtime、rsc-closing-tags 集成测试:8 项通过。
  • app-tools 库构建及类型声明生成通过,修改的 TypeScript 文件通过 rs check。

Related Links

Checklist

  • I have added a patch changeset.
  • I have updated the documentation. (Not needed: this restores the expected entry isolation.)
  • I have added tests to cover my changes.

@changeset-bot

changeset-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c44346e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 120 packages
Name Type
@modern-js/app-tools Patch
@modern-js/adapter-rstest Patch
@modern-js/plugin-bff Patch
@modern-js/plugin-ssg Patch
@modern-js/plugin-styled-components Patch
@modern-js/plugin-i18n Patch
@modern-js/image Patch
@modern-js/runtime Patch
@modern-js/plugin-polyfill Patch
@integration-test/alias-set Patch
app-document Patch
async-entry-test Patch
tmp Patch
bff-api-app Patch
bff-client-app Patch
bff-indep-client-app Patch
bff-hono Patch
integration-clean-dist-path Patch
integration-compatibility Patch
integration-custom-dist-path Patch
custom-file-system-entry Patch
integration-custom-template Patch
deploy Patch
deploy-server Patch
dev-server Patch
integration-disable-html Patch
entries-app-builder Patch
app-custom-entries Patch
app-custom-routes-runtime Patch
app-custom Patch
app-entry Patch
app-route Patch
app-entry-server Patch
i18n-app-csr-html-lang Patch
i18n-app Patch
i18n-app-ssr-html-lang Patch
i18n-app-ssr Patch
i18n-custom-i18n-wrapper Patch
i18n-mf-app-provider Patch
i18n-mf-component-provider Patch
i18n-mf-consumer Patch
i18n-routes Patch
i18n-routes-ssr Patch
@integration-test/image-component Patch
main-entry-name Patch
nonce Patch
pure-esm-project Patch
react-compiler-test Patch
routes-match Patch
routes Patch
app-rsbuild-hooks Patch
rsc-csr-app Patch
rsc-csr-routes Patch
rsc-ssr-app Patch
rsc-ssr-routes Patch
basic-app-rstest-browser Patch
basic-app-rstest Patch
runtime-custom-plugin Patch
runtime-custom-config-plugin Patch
select-mul-entry-test Patch
select-one-entry-test Patch
server-config Patch
server-esm-tsx Patch
server-json-script Patch
server-monitors Patch
server-prod Patch
server-routes Patch
@source-code-build/app Patch
ssg-fixtures-mega-list-routes Patch
ssg-fixtures-nested-routes Patch
ssg-fixtures-simple Patch
ssg-fixtures-web-server Patch
ssr-base-async-entry-test Patch
ssr-base-async-pre-entry-test Patch
ssr-base-json-test Patch
ssr-base-test Patch
ssr-base-fallback-test Patch
init Patch
ssr-base-loadable Patch
ssr-partial-test Patch
rsc-closing-tags-test Patch
ssr-script-loading Patch
ssr-useid-test Patch
ssr-streaming-inline-test Patch
ssr-streaming-lazy-test Patch
ssr-streaming-test Patch
styled-components-stream Patch
styled-components-string Patch
integration-tailwindcss-v2 Patch
integration-tailwindcss-v3 Patch
integration-tailwindcss-v4-tools Patch
integration-tailwindcss-v4 Patch
tmp-dir Patch
tools-plugin-options-test Patch
write-to-dist Patch
@modern-js/bundle-diff-benchmark Patch
@modern-js/main-doc Patch
@modern-js/tsconfig Patch
@modern-js/builder Patch
@modern-js/plugin-data-loader Patch
@modern-js/render Patch
@modern-js/bff-core Patch
@modern-js/bff-runtime Patch
@modern-js/server-core Patch
@modern-js/create-request Patch
@modern-js/prod-server Patch
@modern-js/server-runtime Patch
@modern-js/server Patch
@modern-js/server-utils Patch
@modern-js/create Patch
@modern-js/i18n-utils Patch
@modern-js/plugin Patch
@modern-js/runtime-utils Patch
@modern-js/sandpack-react Patch
@modern-js/types Patch
@modern-js/utils Patch
@modern-js/rslib Patch
@scripts/prebundle Patch
@scripts/rstest-config Patch
@scripts/release-node Patch

Not sure what this means? Click here to learn what changesets are.

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

@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for modernjs-byted ready!

Name Link
🔨 Latest commit c44346e
🔍 Latest deploy log https://app.netlify.com/projects/modernjs-byted/deploys/6ad879adb82b6a5f9f25122a
😎 Deploy Preview https://deploy-preview-9033--modernjs-byted.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 91 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@CLAassistant

CLAassistant commented Oct 21, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@GiveMe-A-Name
GiveMe-A-Name merged commit a04362d into web-infra-dev:main Oct 21, 2026
10 of 11 checks passed
@caohuilin caohuilin mentioned this pull request Oct 21, 2026
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.

3 participants