diff --git a/examples/solid/ssr/basic/app.config.js b/examples/solid/ssr/basic/app.config.js index 9715fafa..d05ba57d 100644 --- a/examples/solid/ssr/basic/app.config.js +++ b/examples/solid/ssr/basic/app.config.js @@ -1,7 +1,14 @@ +import { references } from "@vinxi/plugin-references"; import { createApp } from "vinxi"; import solid from "vite-plugin-solid"; export default createApp({ + server: { + plugins: [references.serverPlugin], + virtual: { + [references.serverPlugin]: references.serverPluginModule, + }, + }, routers: [ { name: "public", @@ -15,7 +22,7 @@ export default createApp({ handler: "./app/client.tsx", build: { target: "browser", - plugins: () => [solid({ ssr: true })], + plugins: () => [references.clientRouterPlugin(), solid({ ssr: true })], }, base: "/_build", }, @@ -28,5 +35,6 @@ export default createApp({ plugins: () => [solid({ ssr: true })], }, }, + references.serverRouter(), ], }); diff --git a/examples/solid/ssr/basic/app/actions.tsx b/examples/solid/ssr/basic/app/actions.tsx new file mode 100644 index 00000000..a843ead4 --- /dev/null +++ b/examples/solid/ssr/basic/app/actions.tsx @@ -0,0 +1,12 @@ +"use server"; + +let store = { count: 0 }; +export function sayHello() { + console.log("Hello World"); + store.count++; + return store.count; +} + +export function getStore() { + return store.count; +} diff --git a/examples/solid/ssr/basic/app/client.tsx b/examples/solid/ssr/basic/app/client.tsx index b24577ac..0ccfcbc1 100644 --- a/examples/solid/ssr/basic/app/client.tsx +++ b/examples/solid/ssr/basic/app/client.tsx @@ -4,8 +4,11 @@ import { createAssets } from "@vinxi/solid"; import { NoHydration, Suspense, hydrate } from "solid-js/web"; import "vinxi/runtime/client"; +import { sayHello } from "./actions"; import App from "./app"; +console.log(await sayHello()); + const Assets = createAssets( import.meta.env.MANIFEST["client"].handler, import.meta.env.MANIFEST["client"], diff --git a/examples/solid/ssr/basic/package.json b/examples/solid/ssr/basic/package.json index ec6fe178..eee3949f 100644 --- a/examples/solid/ssr/basic/package.json +++ b/examples/solid/ssr/basic/package.json @@ -8,6 +8,7 @@ "dependencies": { "@picocss/pico": "^1.5.7", "@solidjs/meta": "^0.28.5", + "@vinxi/plugin-references": "workspace:^", "@vinxi/solid": "workspace:^", "autoprefixer": "^10.4.14", "solid-js": "^1.7.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 21150ce6..9f493ff0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -541,6 +541,9 @@ importers: '@solidjs/meta': specifier: ^0.28.5 version: 0.28.5(solid-js@1.7.8) + '@vinxi/plugin-references': + specifier: workspace:^ + version: link:../../../../packages/vinxi-references '@vinxi/solid': specifier: workspace:^ version: link:../../../../packages/vinxi-solid