@@ -25,6 +25,13 @@ interface PluginConfig {
2525 */
2626 buildDirectory ?: string
2727
28+ /**
29+ * The path to the "hot" file.
30+ *
31+ * @default `${publicDirectory}/hot`
32+ */
33+ hotFile ?: string
34+
2835 /**
2936 * The path of the SSR entry point.
3037 */
@@ -144,8 +151,6 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
144151 }
145152 } ,
146153 configureServer ( server ) {
147- const hotFile = path . join ( pluginConfig . publicDirectory , 'hot' )
148-
149154 const envDir = resolvedConfig . envDir || process . cwd ( )
150155 const appUrl = loadEnv ( resolvedConfig . mode , envDir , 'APP_URL' ) . APP_URL ?? 'undefined'
151156
@@ -155,7 +160,7 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
155160 const isAddressInfo = ( x : string | AddressInfo | null | undefined ) : x is AddressInfo => typeof x === 'object'
156161 if ( isAddressInfo ( address ) ) {
157162 viteDevServerUrl = resolveDevServerUrl ( address , server . config )
158- fs . writeFileSync ( hotFile , viteDevServerUrl )
163+ fs . writeFileSync ( pluginConfig . hotFile , viteDevServerUrl )
159164
160165 setTimeout ( ( ) => {
161166 server . config . logger . info ( `\n ${ colors . red ( `${ colors . bold ( 'LARAVEL' ) } ${ laravelVersion ( ) } ` ) } ${ colors . dim ( 'plugin' ) } ${ colors . bold ( `v${ pluginVersion ( ) } ` ) } ` )
@@ -170,8 +175,8 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
170175 }
171176
172177 const clean = ( ) => {
173- if ( fs . existsSync ( hotFile ) ) {
174- fs . rmSync ( hotFile )
178+ if ( fs . existsSync ( pluginConfig . hotFile ) ) {
179+ fs . rmSync ( pluginConfig . hotFile )
175180 }
176181 }
177182
@@ -268,6 +273,7 @@ function resolvePluginConfig(config: string|string[]|PluginConfig): Required<Plu
268273 ssr : config . ssr ?? config . input ,
269274 ssrOutputDirectory : config . ssrOutputDirectory ?? 'bootstrap/ssr' ,
270275 refresh : config . refresh ?? false ,
276+ hotFile : config . hotFile ?? path . join ( ( config . publicDirectory ?? 'public' ) , 'hot' )
271277 }
272278}
273279
0 commit comments