Repository navigation
feat: add scriptLoading option - #82
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Adding the Rspress case that motivated this option. On the introduction page, repeatedly clicking Chrome's reload/stop button while reading near “Why Rspress” can briefly jump the page to its final sections, then return to the original position. The URL has no hash. In the original recording below, the jump is visible at about 1.4 seconds. Original recordingrspress-reload-scroll-flash.mp4Controlled reproductionTested the production build at Rspress commit
The trace shows a GA callback forcing layout before CSS was ready, followed by Chrome's native This is a controlled reproduction of the same visible symptom; the original recording has no accompanying network trace. The |
The plugin currently always loads
gtag.jsasynchronously. AddscriptLoading: 'async' | 'defer'so sites can opt into execution after HTML parsing without rewriting the generated tags. The default remainsasync, matching Google's setup example.Only the external script's loading attribute changes. The README documents the option and its ordering /
DOMContentLoadedtradeoffs; inlinedataLayerandgtaginitialization is preserved.Validation:
pnpm checkpnpm build(ESM, CJS, and type declarations)async/defer, disabled plugin, missing IDs, and existing user tagsDOMContentLoadedtiming (no live analytics delivery tested)