nWidart / laravel-modules

Module Management In Laravel
https://docs.laravelmodules.com
MIT License
5.54k stars 964 forks source link

Change vite hotfile location #1906

Open jackkitley opened 3 months ago

jackkitley commented 3 months ago

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]);
    }
}
dcblogdev commented 1 month ago

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',
  },
});