Developing Laravle Packages is always a bit more difficult than a base application. Special in packages with assets, it's becoming very thin on content. Today I ran into a problem with using Laravel Vite in a package and the main application.
Assuming you have a Laravel app shipping with Vite. After compiling your assets, you will get a folder /public/build/. In this folder, you have the manifest.json and a /assets folder. The manifest.json specify all the paths and tells your @vite directive in your blade file there to look for the files. In your Package, you have the same structure. If you now just publish the assets with your Package Service Provider, it will overwrite your existing manifest.json. This would result in the problem that Vite can no longer find your asset files.
To solve this problem, you need to configure a different building path in Vite. In your vite.config.js you need to define your build directory. In this example, I used vendor/modular/admin_panel. You can use vendor/package_name. That would do the trick.
In your blade file, you need to load Vite with the same paths.
In your ServiceProvider you need to specify the asset's publish paths.
Now your package assets are independent of the assets in your Laravel Application. You need to build the assets in your Laravel Application and your Package. At the end, publish your assets with your Service Provider.
I hope this helps you save some time. If you found a better way write me a comment :)