Skip to content

[Bug?]: SolidStartOptions does not correctly expose all configuration options #2235

Description

@TymonMarek

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

A consumer cannot currently modify the appRoot configuration property within @solidjs/start/config because the interface SolidStartOptions does not correctly expose it.

vite.config.ts

export default defineConfig({
  plugins: [
    solidStart({
      ssr: true,
      serialization: { mode: 'json' },
      appRoot: "./src/app", // Object literal may only specify known properties, and 'appRoot' does not exist in type 'SolidStartOptions'.
    }),
    nitro(),
  },
});

This means that a consumer cannot configure a custom location for app.{jsx,tsx} other than its default value of ./src; Trying to move app.{jsx,tsx} to another location obviously causes SolidStart to throw an error at build time:

failed to load config from ...\vite.config.ts
error during build:
Error: Could not find an app jsx/tsx entry in ./src.
    at solidStart (...\node_modules\.pnpm\@solidjs+start@2.0.0-rc.1_c_e43557dbf8a2f767076ccd81ef593587\node_modules\@solidjs\start\dist\config\index.js:33:19)
    at  ...\node_modules\.vite-temp\vite.config.ts.timestamp-1784969116190-c1997d34f8c858.mjs:15:12
    at processTicksAndRejections (native:7:39)
error: "vite.cmd" exited with code 1
[ELIFECYCLE] Command failed with exit code 1.

This also affects configuration properties that are relative to appRoot, such as routeDir.

Expected behavior 🤔

SolidStartOptions should expose all options that can be passed to @solidjs/start/config so that a consumer is able to modify these by passing arguments to the Vite plugin.

Steps to reproduce 🕹

Steps:

  1. Create a new SolidStart project.
> pnpm create solid
┌  
 Create-Solid v0.8.0
│
◇  Project Name
│  solid-project
│
◇  What type of project would you like to create?
│  SolidStart
│
◇  Which version of SolidStart?
│  v2 (pre-release, recommended)
│
◇  Use Typescript?
│  Yes
│
◇  Which template would you like to use?
│  basic
│
◇  Project created 🎉
│
◇  To get started, run: ─╮
│                        │
│  cd solid-project      │
│  pnpm install          │
│  pnpm dev              │
│                        │
├────────────────────────╯
  1. Modify vite.config.ts, passing a appRoot configuration option to solidStart.
import { nitro } from 'nitro/vite';
import { defineConfig } from 'vite';

import { solidStart } from '@solidjs/start/config';

export default defineConfig({
  plugins: [
-    solidStart(),
+    solidStart({
+      appRoot: './src/app',
+    }),
    nitro(),
  ],
});
  1. Move app.{jsx,tsx} to the configured appRoot.
> mkdir ./src/app
> mv ./src/app.tsx ./src/app/app.tsx
  1. Attempt to build the project using pnpm build.
> pnpm build
failed to load config from ...\vite.config.ts
error during build:
Error: Could not find an app jsx/tsx entry in ./src.
    at solidStart (...\node_modules\.pnpm\@solidjs+start@2.0.0-rc.1_c_e43557dbf8a2f767076ccd81ef593587\node_modules\@solidjs\start\dist\config\index.js:33:19)
    at  ...\node_modules\.vite-temp\vite.config.ts.timestamp-1784969116190-c1997d34f8c858.mjs:15:12
    at processTicksAndRejections (native:7:39)
error: "vite.cmd" exited with code 1
[ELIFECYCLE] Command failed with exit code 1.

Context 🔦

Ideally, all configuration options that can be provided to SolidStart should be exposed to consumers, and if that is not the intention of the configuration value, then it should be refactored into some other primitive such as a feature flag. Hiding these options from consumers limits the flexibility and freedom of how it is used, which may impact developer experience. I discovered this issue by trying to refactor a SolidStart project to a similar directory structure as NextJS's /app router.

Your environment 🌎

System:
    OS: Windows 11 Pro 25H2 (26200.8875)
    CPU: AMD Ryzen 5 3600 6-Core Processor (3.60 GHz)
Binaries:
    Node: 24.14.1
    Bun: 1.3.14
    pnpm: 11.17.0
npmPackages:
    @solidjs/start: 2.0.0-alpha
    solid-js: 1.9.14
    vite: 8.1.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions