laravel-modules icon indicating copy to clipboard operation
laravel-modules copied to clipboard

Change vite hotfile location

Open jackkitley opened this issue 1 year ago • 1 comments

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]);
    }
}

jackkitley avatar Jul 22 '24 18:07 jackkitley

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

dcblogdev avatar Sep 14 '24 09:09 dcblogdev