@decocms/start 6.4.2 → 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 +22 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/start",
3
- "version": "6.4.2",
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",
@@ -471,6 +471,28 @@ export function decoVitePlugin() {
471
471
  env.optimizeDeps.esbuildOptions.jsx = "automatic";
472
472
  env.optimizeDeps.esbuildOptions.jsxImportSource = "react";
473
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
+ }
474
496
  },
475
497
 
476
498
  generateBundle(_, bundle) {