Skip to content

Commit

Permalink
fix(solid-start): #269 fix build of solid-start apps
Browse files Browse the repository at this point in the history
When running vinxi build on a Solid Start app the project builds in the following order:

- Router ssr at base path /_build
- Router client at base path /_build
- Router server-fns at base path /_server

Based on this we can see that the isEnabled fn will only return true on the last phase of the build. In practice this means the build fails on the first step due to missing files in the codegen directory.

With this change the isEnabled flag is true for the first step which is the ssr one.
---------

Co-authored-by: Sebastian Sdorra <[email protected]>
  • Loading branch information
oscartbeaumont and sdorra authored Aug 31, 2024
1 parent 4199676 commit 6e9d41f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/seven-shrimps-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@content-collections/solid-start": patch
---

Fix build of solid-start apps, by generating the collections on the ssr phase instead of the server-fns phase.
6 changes: 2 additions & 4 deletions packages/solid-start/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ export default function remixContentCollectionsPlugin(
const plugin = contentCollectionsPlugin({
...(options || {}),
isEnabled(config) {
if (config.base === "/_server") {
return true;
}
return false;
// @ts-ignore router is an solid-start internal property
return config.router?.name === "ssr";
},
});

Expand Down

0 comments on commit 6e9d41f

Please sign in to comment.