|
1 | 1 | import { TanStackServerFnPlugin } from "@tanstack/server-functions-plugin"; |
2 | 2 | import { defu } from "defu"; |
3 | 3 | import { globSync } from "node:fs"; |
4 | | -import { extname, isAbsolute, join, normalize } from "node:path"; |
5 | | -import { fileURLToPath } from "node:url"; |
| 4 | +import { extname, isAbsolute, join } from "node:path"; |
6 | 5 | import { type PluginOption } from "vite"; |
7 | 6 | import solid, { type Options as SolidOptions } from "vite-plugin-solid"; |
8 | 7 |
|
@@ -184,33 +183,23 @@ export function solidStart(options?: SolidStartOptions): Array<PluginOption> { |
184 | 183 | envConsumer: "client", |
185 | 184 | envName: VITE_ENVIRONMENTS.client, |
186 | 185 | getRuntimeCode: () => |
187 | | - `import { createServerReference } from "${normalize( |
188 | | - fileURLToPath(new URL("../server/server-runtime", import.meta.url)), |
189 | | - )}"`, |
| 186 | + `import { createServerReference } from "@solidjs/start/client/rpc"`, |
190 | 187 | replacer: (opts) => |
191 | 188 | `createServerReference(${() => {}}, '${opts.functionId}', '${opts.extractedFilename}')`, |
192 | 189 | }, |
193 | 190 | { |
194 | 191 | envConsumer: "server", |
195 | 192 | envName: VITE_ENVIRONMENTS.server, |
196 | 193 | getRuntimeCode: () => |
197 | | - `import { createServerReference } from '${normalize( |
198 | | - fileURLToPath( |
199 | | - new URL("../server/server-fns-runtime", import.meta.url), |
200 | | - ), |
201 | | - )}'`, |
| 194 | + `import { createServerReference } from "@solidjs/start/server/rpc"`, |
202 | 195 | replacer: (opts) => |
203 | 196 | `createServerReference(${opts.fn}, '${opts.functionId}', '${opts.extractedFilename}')`, |
204 | 197 | } |
205 | 198 | ], |
206 | 199 | provider: { |
207 | 200 | envName: VITE_ENVIRONMENTS.server, |
208 | 201 | getRuntimeCode: () => |
209 | | - `import { createServerReference } from '${normalize( |
210 | | - fileURLToPath( |
211 | | - new URL("../server/server-fns-runtime", import.meta.url), |
212 | | - ), |
213 | | - )}'`, |
| 202 | + `import { createServerReference } from "@solidjs/start/server/rpc"`, |
214 | 203 | replacer: (opts) => |
215 | 204 | `createServerReference(${opts.fn}, '${opts.functionId}', '${opts.extractedFilename}')`, |
216 | 205 | }, |
|
0 commit comments