Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions e2e/templates/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
"@types/react-dom": "^19.1.6",
"esbuild": "^0.24.2",
"typescript": "^5.8.2",
"vite": "^7.0.5",
"vite": "^7.1.7",
"vite-tsconfig-paths": "^5.1.4",
"wrangler": "^4.23.0"
"wrangler": "^4.40.1"
},
"dependencies": {
"@orange-js/orange": "workspace:",
"@orange-js/actors": "workspace:",
"@orange-js/orange": "workspace:",
"@tailwindcss/vite": "^4.0.14",
"hono": "^4.6.20",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"tailwindcss": "^4.0.14"
}
}
12 changes: 8 additions & 4 deletions packages/actors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./client": {
"import": "./dist/client.js",
"types": "./dist/client.d.ts"
}
},
"scripts": {
Expand All @@ -17,8 +21,8 @@
},
"devDependencies": {
"@types/react": "^19.1.8",
"@vitejs/plugin-rsc": "^0.4.12",
"react": "^19.1.0",
"@vitejs/plugin-rsc": "^0.4.31",
"react": "^19.1.1",
"typescript": "^5.7.2"
},
"keywords": [],
Expand All @@ -27,7 +31,7 @@
"packageManager": "pnpm@10.13.1",
"peerDependencies": {
"@cloudflare/actors": "0.0.1-beta.1",
"@vitejs/plugin-rsc": "^0.4.12",
"react": "^19.1.0"
"@vitejs/plugin-rsc": "^0.4.31",
"react": "^19.1.1"
}
}
3 changes: 0 additions & 3 deletions packages/actors/src/cl.tsx → packages/actors/src/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ function rsc() {
return globalThis.rsc as typeof import("@vitejs/plugin-rsc/rsc");
}

// @ts-ignore
globalThis._dawgdhaigdauwgd = "use client";

type ClientComponentProps = {
children: React.ReactNode;
actorName: string;
Expand Down
15 changes: 14 additions & 1 deletion packages/actors/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from "react";
import { ActorState, Actor as CfActor, getActor } from "@cloudflare/actors";
import { isValidElement } from "react";
import { ClientComponent } from "./cl.js";
import { observedSymbol } from "./observed.js";

export * from "@cloudflare/actors";
Expand Down Expand Up @@ -111,6 +110,20 @@ async function Component<T extends Actor<Env>, Env>(
) {
const { root, isObserved } = await internalComponent(props);

let ClientComponent: React.ComponentType<any>;

// With Vite's pre-bundling in dev mode esbuild will bundle this dependency into
// a single ES module, but since we need the client module to be "use client" we
// need to ensure that it isn't bundled into a single module.
if (process.env.NODE_ENV === "development") {
// We need to ensure TS doesn't actually resolve this import to prevent it
// from refusing to emit this file.
ClientComponent = (await import("@orange-js" + "/actors/client"))
.ClientComponent;
} else {
ClientComponent = (await import("./client.js")).ClientComponent;
}

if (isObserved) {
return (
<ClientComponent
Expand Down
6 changes: 3 additions & 3 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@
"author": "zeb@zebulon.dev",
"license": "MIT",
"devDependencies": {
"@cloudflare/vite-plugin": "^1.13.6",
"@swc/core": "^1.11.20",
"@types/babel__generator": "^7.6.8",
"@types/babel__traverse": "^7.20.6",
"@types/node": "^22.13.0",
"typescript": "^5.7.2",
"vite": "^7.0.5"
"vite": "^7.1.5"
},
"dependencies": {
"@babel/generator": "^7.26.5",
"@babel/parser": "^7.26.7",
"@babel/plugin-proposal-decorators": "^7.28.0",
"@babel/traverse": "^7.26.7",
"@babel/types": "^7.26.7",
"@cloudflare/vite-plugin": "^1.9.0",
"@swc-node/core": "^1.13.3",
"@vitejs/plugin-react": "^4.7.0",
"@vitejs/plugin-rsc": "^0.4.12",
"@vitejs/plugin-rsc": "^0.4.31",
"dedent": "^1.5.3",
"es-module-lexer": "^1.6.0",
"minimatch": "^10.0.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/vite/src/plugins/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export function configPlugin(): Plugin {
},
},
optimizeDeps: {
exclude: ["virtual:orange/routes", "@orange-js/actors"],
include: ["react", "react-dom", "@orange-js/actors"],
exclude: ["virtual:orange/routes", "@orange-js/actors/client"],
},
},
ssr: {
Expand Down
Loading