@decocms/start 6.4.1 → 6.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/vite/plugin.js +26 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/start",
3
- "version": "6.4.1",
3
+ "version": "6.4.3",
4
4
  "type": "module",
5
5
  "description": "Deco framework for TanStack Start - CMS bridge, admin protocol, hooks, schema generation",
6
6
  "main": "./src/index.ts",
@@ -363,7 +363,10 @@ export function decoVitePlugin() {
363
363
  site: siteName,
364
364
  env: envName,
365
365
  port,
366
- decoHost: process.env.DECO_HOST === "true",
366
+ // Default to the .deco.host relay (matches startTunnel's documented
367
+ // default). Set DECO_HOST=false to opt back into the legacy
368
+ // simpletunnel.deco.site relay.
369
+ decoHost: process.env.DECO_HOST !== "false",
367
370
  });
368
371
  server.httpServer?.on("close", () => tunnel.close());
369
372
  } catch (err) {
@@ -468,6 +471,28 @@ export function decoVitePlugin() {
468
471
  env.optimizeDeps.esbuildOptions.jsx = "automatic";
469
472
  env.optimizeDeps.esbuildOptions.jsxImportSource = "react";
470
473
  }
474
+
475
+ // Force @decocms/start through the SSR transform pipeline so TanStack
476
+ // Start's compiler can register the framework's createServerFn handlers
477
+ // (loadDeferredSection, etc.) in the per-environment serverFnsById
478
+ // manifest. Without this, Vite pre-bundles @decocms/start via
479
+ // optimizeDeps before plugins run, the handler never enters the
480
+ // manifest, and every POST /_serverFn/* call from the browser returns
481
+ // HTTP 500 ("Invalid server function ID"). See #197.
482
+ if (name === "ssr") {
483
+ env.resolve = env.resolve || {};
484
+ const existing = env.resolve.noExternal;
485
+ const additions = ["@decocms/start"];
486
+ if (existing === true) {
487
+ // Already noExternal everything — nothing to add.
488
+ } else if (Array.isArray(existing)) {
489
+ env.resolve.noExternal = [...new Set([...existing, ...additions])];
490
+ } else if (existing) {
491
+ env.resolve.noExternal = [existing, ...additions];
492
+ } else {
493
+ env.resolve.noExternal = additions;
494
+ }
495
+ }
471
496
  },
472
497
 
473
498
  generateBundle(_, bundle) {