Skip to content

Conversation

@hi-ogawa
Copy link
Owner

@hi-ogawa hi-ogawa commented Apr 30, 2025

Copy link
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Comment on lines +31 to +34
head = head.replace(
'<script type="module">',
'<script type="module" async>',
);
Copy link
Owner Author

Choose a reason for hiding this comment

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

Without async attribute, http://localhost:5173/test/loading/1 ("hydrate while streaming" example) fails by

chunk-3WLTBFGF.js:9 Uncaught Error: @vitejs/plugin-react can't detect preamble. Something is wrong.
    at chunk-3WLTBFGF.js:9:11

Comment on lines +456 to +460
// import RefreshRuntime from "/@react-refresh";
// RefreshRuntime.injectIntoGlobalHook(window);
// window.$RefreshReg$ = () => {};
// window.$RefreshSig$ = () => (type) => type;
// window.__vite_plugin_react_preamble_installed__ = true;
Copy link
Owner Author

Choose a reason for hiding this comment

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

Practically speaking, we shouldn't have to worry about race condition since head script should finish first, so we don't need manual preamble injection.

@hi-ogawa hi-ogawa changed the title test: test react preamble script async (not merge) chore: test react preamble script async Apr 30, 2025
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.

2 participants