Repository navigation
fix(compiler): guard webpack HMR dispose data on first module evaluation - #389
Merged
trueadm merged 1 commit intoJul 29, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
trueadm
approved these changes
Jul 29, 2026
This was referenced Jul 30, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hot.datain the universal renderer's webpack-HMR handoff so a module's first evaluation no longer crashes.Why
module.hot.dataundefineduntil a previous instance of the module has disposed. The emitted handoff readhot.data.__octaneUniversalComponentsunguarded, so every dev bundle compiled with the webpack HMR dialect threwTypeError: cannot read property '__octaneUniversalComponents' of undefinedat module init.pluginOctane({ dev: true, hmr: true })Rspeedy bundle crashed on Lynx Explorer 3.9 (iOS) before rendering. The Vite dialect never hit this because Vite initializesimport.meta.hot.datato{}; the DOM webpack dialect already guards through optional member access.Changes
compile-universal.js:hmrHandoffStatementsnow emitshot.data && hot.data.__octaneUniversalComponents && …instead of dereferencinghot.datadirectly.universal-renderer.test.ts: new behavioral regression that compiles a webpack-HMR universal module and executes it against a webpack-shaped hot object withdata: undefined(throws pre-fix with the exact device error), then replays the dispose bag and asserts the retained component keeps canonical identity.Validation
vitest run packages/octane/tests/universal-renderer.test.ts— 176 passed (octane + octane-prod projects)TypeError: Cannot read properties of undefined (reading '__octaneUniversalComponents')in both projectsprettier --checkon changed filespnpm test/pnpm typechecknot run for this PR (compiler-local change; full lynx-project suite was run on the combined branch during device verification)Risk / follow-ups
hot.datais defined and the handoff behaves exactly as before.Note
Low Risk
Scoped to dev/HMR codegen in the universal compiler; production bundles are unaffected and hot-update paths behave the same when
hot.datais defined.Overview
Fixes a dev-only crash on the first load of universal modules built with the webpack/rspack HMR dialect: emitted handoff code now checks
hot.dataexists before reading__octaneUniversalComponents, matching webpack/rspack semantics (dispose bag is undefined until the prior module instance disposes).Adds a behavioral regression test that compiles a webpack-HMR universal module, evaluates it with
data: undefined, then replays dispose and asserts component identity is preserved on hot update. Production output is unchanged; only generated HMR handoff differs.Reviewed by Cursor Bugbot for commit ad58530. Bugbot is set up for automated code reviews on this repo. Configure here.