@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
66import { normalizePath , type PluginOption , type Rollup , type ViteDevServer } from "vite" ;
77import solid , { type Options as SolidOptions } from "vite-plugin-solid" ;
88
9- import { CLIENT_BASE_PATH , DEFAULT_EXTENSIONS , VIRTUAL_MODULES } from "../constants.js" ;
9+ import { CLIENT_BASE_PATH , DEFAULT_EXTENSIONS , VIRTUAL_MODULES , VITE_ENVIRONMENTS } from "../constants.js" ;
1010import { isCssModulesFile } from "../server/collect-styles.js" ;
1111import { getSsrDevManifest } from "../server/manifest/dev-ssr-manifest.js" ;
1212import { SolidStartClientFileRouter , SolidStartServerFileRouter } from "./fs-router.js" ;
@@ -108,7 +108,7 @@ function solidStartVitePlugin(options?: SolidStartOptions): Array<PluginOption>
108108 return {
109109 base : env . command === "build" ? `/${ CLIENT_BASE_PATH } ` : undefined ,
110110 environments : {
111- client : {
111+ [ VITE_ENVIRONMENTS . client ] : {
112112 consumer : "client" ,
113113 build : {
114114 copyPublicDir : false ,
@@ -125,7 +125,7 @@ function solidStartVitePlugin(options?: SolidStartOptions): Array<PluginOption>
125125 }
126126 }
127127 } ,
128- server : {
128+ [ VITE_ENVIRONMENTS . server ] : {
129129 consumer : "server" ,
130130 build : {
131131 ssr : true ,
@@ -184,7 +184,7 @@ function solidStartVitePlugin(options?: SolidStartOptions): Array<PluginOption>
184184 dir : absolute ( routeDir , root ) ,
185185 extensions
186186 } ) ,
187- server :
187+ ssr :
188188 new SolidStartServerFileRouter ( {
189189 dir : absolute ( routeDir , root ) ,
190190 extensions,
@@ -199,6 +199,7 @@ function solidStartVitePlugin(options?: SolidStartOptions): Array<PluginOption>
199199 // our server function manifest and resolve its module
200200 manifestVirtualImportId : VIRTUAL_MODULES . serverFnManifest ,
201201 client : {
202+ envName : VITE_ENVIRONMENTS . client ,
202203 getRuntimeCode : ( ) =>
203204 `import { createServerReference } from "${ normalize (
204205 fileURLToPath ( new URL ( "../server/server-runtime.js" , import . meta. url ) )
@@ -207,6 +208,7 @@ function solidStartVitePlugin(options?: SolidStartOptions): Array<PluginOption>
207208 `createServerReference(${ ( ) => { } } , '${ opts . functionId } ', '${ opts . extractedFilename } ')`
208209 } ,
209210 server : {
211+ envName : VITE_ENVIRONMENTS . server ,
210212 getRuntimeCode : ( ) =>
211213 `import { createServerReference } from '${ normalize (
212214 fileURLToPath ( new URL ( "../server/server-fns-runtime.js" , import . meta. url ) )
@@ -221,11 +223,11 @@ function solidStartVitePlugin(options?: SolidStartOptions): Array<PluginOption>
221223 async resolveId ( id ) {
222224 if ( id === VIRTUAL_MODULES . clientViteManifest ) return `\0${ VIRTUAL_MODULES . clientViteManifest } ` ;
223225 if ( id === VIRTUAL_MODULES . getClientManifest )
224- return new URL ( "../server/manifest/client-manifest.js " , import . meta. url ) . pathname ;
226+ return this . resolve ( new URL ( "../server/manifest/client-manifest" , import . meta. url ) . pathname ) ;
225227 if ( id === VIRTUAL_MODULES . getManifest ) {
226228 return this . environment . config . consumer === "client" ?
227- new URL ( "../server/manifest/client-manifest.js " , import . meta. url ) . pathname :
228- new URL ( "../server/manifest/ssr-manifest.js " , import . meta. url ) . pathname ;
229+ this . resolve ( new URL ( "../server/manifest/client-manifest" , import . meta. url ) . pathname ) :
230+ this . resolve ( new URL ( "../server/manifest/ssr-manifest" , import . meta. url ) . pathname ) ;
229231 }
230232 if ( id === VIRTUAL_MODULES . middleware ) {
231233 if ( start . middleware ) return await this . resolve ( start . middleware ) ;
0 commit comments