Skip to content

Commit b19ff69

Browse files
committed
revert vite alignment until we know more, add server option to types
1 parent b82264e commit b19ff69

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

.changeset/tiny-crews-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/start": patch
3+
---
4+
5+
revert vite alignment until we know more, add server option to types

docs/routes/api/app-config.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ export default defineConfig({
5151
});
5252
```
5353

54-
The `vite` option can also be a function which can be customized for each Vinxi environment. In SolidStart we use 3, `server` for SSR, `client` for the browser, and `server-function` for server functions.
54+
The `vite` option can also be a function which can be customized for each Vinxi router. In SolidStart we use 3, `server` for SSR, `client` for the browser, and `server-function` for server functions.
5555

5656
```tsx
5757
import { defineConfig } from "@solidjs/start/config";
5858

5959
export default defineConfig({
60-
vite({ enviroment }) {
61-
if (enviroment === "server") {
62-
} else if (enviroment === "client") {
63-
} else if (enviroment === "server-function") {
60+
vite({ router }) {
61+
if (router === "server") {
62+
} else if (router === "client") {
63+
} else if (router === "server-function") {
6464
}
6565
return { plugins: [] };
6666
}

packages/start/config/index.d.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import type { AppOptions } from "vinxi";
22
import type { CustomizableConfig } from "vinxi/dist/types/lib/vite-dev";
3+
import { InlineConfig } from "vite";
34
import type { Options } from "vite-plugin-solid";
45

6+
// atleast until we sort which server options are good to use
7+
type ViteCustomizableConfig = CustomizableConfig & {
8+
server?: InlineConfig["server"];
9+
}
10+
511
type SolidStartInlineConfig = {
612
ssr?: boolean;
713
solid?: Options;
@@ -15,8 +21,8 @@ type SolidStartInlineConfig = {
1521
islands?: boolean;
1622
}
1723
vite?:
18-
| CustomizableConfig
19-
| ((options: { environment: "server" | "client" | "server-function" }) => CustomizableConfig);
24+
| ViteCustomizableConfig
25+
| ((options: { router: "server" | "client" | "server-function" }) => ViteCustomizableConfig);
2026
};
2127

2228
export declare function defineConfig(baseConfig?: SolidStartInlineConfig): any;

packages/start/config/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function defineConfig(baseConfig = {}) {
9191
extensions,
9292
target: "server",
9393
plugins: async () => {
94-
const userConfig = typeof vite === "function" ? await vite({ environment: "server" }) : { ...vite };
94+
const userConfig = typeof vite === "function" ? await vite({ router: "server" }) : { ...vite };
9595
const plugins = userConfig.plugins || [];
9696
delete userConfig.plugins;
9797
return [
@@ -150,7 +150,7 @@ export function defineConfig(baseConfig = {}) {
150150
extensions,
151151
target: "browser",
152152
plugins: async () => {
153-
const userConfig = typeof vite === "function" ? await vite({ environment: "client" }) : { ...vite };
153+
const userConfig = typeof vite === "function" ? await vite({ router: "client" }) : { ...vite };
154154
const plugins = userConfig.plugins || [];
155155
delete userConfig.plugins;
156156
return [
@@ -212,7 +212,7 @@ export function defineConfig(baseConfig = {}) {
212212
target: "server",
213213
routes: solidStartServerFsRouter({ dir: routeDir, extensions }),
214214
plugins: async () => {
215-
const userConfig = typeof vite === "function" ? await vite({ environment: "server-function" }) : { ...vite };
215+
const userConfig = typeof vite === "function" ? await vite({ router: "server-function" }) : { ...vite };
216216
const plugins = userConfig.plugins || [];
217217
delete userConfig.plugins;
218218
return [

0 commit comments

Comments
 (0)