diff --git a/.changeset/bundle-h3-cookie.md b/.changeset/bundle-h3-cookie.md new file mode 100644 index 000000000..cd1e7bc55 --- /dev/null +++ b/.changeset/bundle-h3-cookie.md @@ -0,0 +1,5 @@ +--- +"@solidjs/start": patch +--- + +Bundle `h3` and `cookie-es` into server builds to avoid resolving incompatible hoisted versions diff --git a/packages/start/src/config/index.ts b/packages/start/src/config/index.ts index 447f26ab7..b40c21ddb 100644 --- a/packages/start/src/config/index.ts +++ b/packages/start/src/config/index.ts @@ -158,7 +158,14 @@ export function solidStart(options?: SolidStartOptions): Array { }, // Depending on the package manager and dependency structure Vite externalizes @solidjs/start // This makes sure that @solidjs/start goes through the Vite build process - noExternal: ["@solidjs/start"], + // + // h3 and cookie-es must be bundled as well: if they stay external, the server build + // emits bare imports that nitro later re-resolves from the project root, where package + // managers like yarn may have hoisted the older major versions required by nitropack + // and unstorage (h3 v1 / cookie-es v1) instead of the versions @solidjs/start needs + // (see https://github.com/solidjs/solid-start/issues/2101 + // and https://github.com/solidjs/solid-start/issues/2178) + noExternal: ["@solidjs/start", "h3", "cookie-es"], }, define: { "import.meta.env.MANIFEST": `globalThis.MANIFEST`,