laravel-modules
laravel-modules copied to clipboard
Change vite hotfile location
Hello
Is it possible to change the hotfile location for a module?
I see in helpers it points to storage() which points to the root laravel storage path. I would like a separate hot file in my module .
I did this and it worked for me but want to know if there is another way:
if (! function_exists('module_vite')) {
/**
* support for vite
*/
function module_vite($module, $asset): Vite
{
return ViteFacade::useHotFile(module_path('Retail','storage/vite.hot'))->useBuildDirectory($module)->withEntryPoints([$asset]);
}
}
I think that's a good solution, another way would be when your module used its own vite config something like this may work
import { defineConfig } from 'vite';
export default defineConfig({
server: {
hot: true,
host: 'localhost',
port: 3000,
hotFile: 'storage/vite.hot', // Custom path for the hot file
},
build: {
outDir: 'public/build',
},
});