File tree Expand file tree Collapse file tree
packages/start/src/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { relative } from "node:path" ;
2- import type { PluginOption , ResolvedConfig } from "vite" ;
2+ import type { PluginOption } from "vite" ;
33
4+ import { VITE_ENVIRONMENTS } from "../../constants.js" ;
45import { fileSystemWatcher } from "./fs-watcher.js" ;
56import type { BaseFileSystemRouter } from "./router.js" ;
67import { treeShake } from "./tree-shake.js" ;
@@ -57,7 +58,7 @@ export function fsRoutes({ routers }: FsRoutesArgs): Array<PluginOption> {
5758 src : relative ( root , buildId ) ,
5859 build : isBuild ? `_$() => import(/* @vite-ignore */ '${ buildId } ')$_` : undefined ,
5960 import :
60- this . environment . name === " server"
61+ this . environment . name === VITE_ENVIRONMENTS . server
6162 ? `_$() => import(/* @vite-ignore */ '${ buildId } ')$_`
6263 : `_$(() => clientManifestImport('${ relative ( root , buildId ) } '))$_`
6364 } ;
@@ -69,7 +70,7 @@ export function fsRoutes({ routers }: FsRoutesArgs): Array<PluginOption> {
6970
7071 const code = `
7172${ js . getImportStatements ( ) }
72- ${ this . environment . name === " server"
73+ ${ this . environment . name === VITE_ENVIRONMENTS . server
7374 ? ""
7475 : `
7576import { getClientManifest } from "solid-start:get-client-manifest";
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ function solidStartVitePlugin(options?: SolidStartOptions): Array<PluginOption>
8383 configEnvironment ( name ) {
8484 return {
8585 define : {
86- "import.meta.env.SSR" : JSON . stringify ( name === " server" )
86+ "import.meta.env.SSR" : JSON . stringify ( name === VITE_ENVIRONMENTS . server )
8787 }
8888 } ;
8989 } ,
Original file line number Diff line number Diff line change 1- import { promises as fsp } from "node:fs" ;
2- import path , { dirname , resolve } from "node:path" ;
31import {
42 createApp ,
53 createEvent ,
@@ -16,6 +14,8 @@ import {
1614 prepare ,
1715 prerender ,
1816} from "nitropack" ;
17+ import { promises as fsp } from "node:fs" ;
18+ import path , { dirname , resolve } from "node:path" ;
1919import {
2020 type Connect ,
2121 type EnvironmentOptions ,
@@ -129,7 +129,7 @@ export function nitroPlugin(
129129 {
130130 name : "solid-start-vite-plugin-nitro" ,
131131 configEnvironment ( name ) {
132- if ( name === " server" ) {
132+ if ( name === VITE_ENVIRONMENTS . server ) {
133133 return {
134134 build : {
135135 commonjsOptions : {
@@ -151,8 +151,8 @@ export function nitroPlugin(
151151 builder : {
152152 sharedPlugins : true ,
153153 async buildApp ( builder ) {
154- const clientEnv = builder . environments [ " client" ] ;
155- const serverEnv = builder . environments [ " server" ] ;
154+ const clientEnv = builder . environments [ VITE_ENVIRONMENTS . client ] ;
155+ const serverEnv = builder . environments [ VITE_ENVIRONMENTS . server ] ;
156156
157157 if ( ! clientEnv ) throw new Error ( "Client environment not found" ) ;
158158 if ( ! serverEnv ) throw new Error ( "SSR environment not found" ) ;
You can’t perform that action at this time.
0 commit comments