vite.config.ts
vite.config.ts
is where you configure your application.
tsx
import netlify from "solid-start-netlify";import solid from "solid-start/vite";import { defineConfig } from "vite";export default defineConfig({plugins: [solid({adapter: netlify({ edge: true })})]});
tsx
import netlify from "solid-start-netlify";import solid from "solid-start/vite";import { defineConfig } from "vite";export default defineConfig({plugins: [solid({adapter: netlify({ edge: true })})]});
Usage
Configuring your application
SolidStart is built with Vite. It is little more than a collection of Vite plugins that enable all the functionality that we see here. This is an incredibly powerful approach as we get to leverage Vite's whole ecosystem of plugins to enhance our applications.
The core plugin used by SolidStart is found at solid-start/vite
. The main configuration for it is setting the adapter. Adapter's in SolidStart set the environment to which your project is deployed. Currently, SolidStart supports:
- Node
- Static hosting
- Netlify Functions & Edge
- Vercel Functions & Edge
- AWS Lambda & Lambda@Edge
- Cloudflare Workers & Pages
- Deno Deploy
The simplest usage is passing no arguments, which defaults to the Node adapter. Other adapters must be installed in your project and added to the configuration via the adapter
option. For example, this uses Netlify Edge:
tsx
import netlify from "solid-start-netlify";import solid from "solid-start/vite";import { defineConfig } from "vite";export default defineConfig({plugins: [solid({adapter: netlify({ edge: true })})]});
tsx
import netlify from "solid-start-netlify";import solid from "solid-start/vite";import { defineConfig } from "vite";export default defineConfig({plugins: [solid({adapter: netlify({ edge: true })})]});
Reference
solid-start/vite
The vite plugin exposes the following options:
adapter
(string | Adapter, default"node"
): sets the adapter.appRoot
(string, default"./src"
): sets the root of the application code.routesDir
(string, default"./routes"
): the path to where the routes are located.rootEntry
(string, default"./root.tsx"
): the file path where to the root.clientEntry
(string, default"./entry-client.tsx"
): the file path where to the client entry.serverEntry
(string, default"./entry-server.tsx"
): the file path where to the server entry.prerenderRoutes
(string[], default[]
): list of route paths to prerender (currently only works with static adapter).inspect
(boolean, defaulttrue
): turns on whether vite inspect plugin is enabled.ssr
(boolean, defaulttrue
): toggles between client rendering and server rendering (ssr) mode.islands
(boolean, defaultfalse
): experimental toggles on "islands" mode.islandsRouter
(boolean, defaultfalse
): experimental toggles on hybrid "islands" routing.