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

hot module reloading for HTML import development mode #16955

Merged
merged 34 commits into from
Feb 8, 2025
Merged

Conversation

paperclover
Copy link
Member

@paperclover paperclover commented Feb 1, 2025

Fixes #16335

DevServer gains a new type of RouteBundle for HTML imports. HTML imports have no server files, but may co-exist alongside server routes. While only SPA-style apps are supported now, the tech supports RSC in the same graph as these HTML route bundles.

Instead of framework: "react", the framework option is currently unspecifiable. To allow React to 'just work', the default framework will automatically configure react-refresh if it is installed. If only react is installed, then an embedded copy of react-refresh is enabled to make that also 'just work'.

This PR also resolves some but not all requirements to use HMR reliably, so I still call it experimental. It is very close though.

@robobun
Copy link

robobun commented Feb 1, 2025

Updated 10:40 PM PT - Feb 7th, 2025

@paperclover, your commit d2771a1 has 2 failures in Build #11299:


🧪   try this PR locally:

bunx bun-pr 16955

@paperclover paperclover changed the title experimental hot module reloading for HTML import development mode hot module reloading for HTML import development mode Feb 8, 2025
@paperclover paperclover marked this pull request as ready for review February 8, 2025 02:47
@@ -10,8 +10,8 @@
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"@vscode/debugadapter": "^1.65.0",
"autoprefixer": "^10.4.20",
"caniuse-lite": "^1.0.30001660",
"autoprefixer": "^10.4.19",
Copy link
Collaborator

Choose a reason for hiding this comment

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

downgraded


if (bun.FeatureFlags.bake_debugging_features and dev.has_pre_crash_handler)
try bun.crash_handler.appendPreCrashHandler(DevServer, dev, dumpStateDueToCrash);

return dev;
}

pub fn deinit(dev: *DevServer) void {
// TODO: Currently deinit is not implemented, as it was assumed to be alive for
// the remainder of this process' lifespan. This isn't always true.
Copy link
Collaborator

Choose a reason for hiding this comment

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

is especially not true now that server.stop() can make this happen

}

fn memoryCostArrayList(slice: anytype) usize {
return slice.capacity * @sizeOf(@typeInfo(@TypeOf(slice.items)).pointer.child);
Copy link
Collaborator

Choose a reason for hiding this comment

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

imo this is too clever it can just use allocatedSlice() or one of those

@Jarred-Sumner Jarred-Sumner merged commit f912e0a into main Feb 8, 2025
64 of 69 checks passed
@Jarred-Sumner Jarred-Sumner deleted the chloe/hmr branch February 8, 2025 08:31
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.

--experimental-html with --minify removes content in <head>
3 participants