Closed arthvrian closed 2 years ago
Hi @arthvrian,
If we were to do this, we'd also need to provide a way to specify the custom manifest location on the Laravel side of things too.
It should be fairly straight-forward, especially after https://github.com/laravel/framework/pull/43442 is merged.
Thoughts @timacdonald?
@arthvrian are you actually experiencing this conflict? Is there any specific reason you are trying to put things in the root /public
directory?
If you are doing this, isn't it also deleting your index.php
, robots.txt
, favicon.ico` and everything else that is static in the public directory (as Vite clears everything out of the build directory when it builds the assets)? I would imagine doing this renders your Laravel application un-usable as it can no longer receive requests?
@jessarcher you are right
@timacdonald I'm just trying to mimic the behaviour of -mix- using -vite-, taking advantage of the speed of -vite- to compile, but leaving the resulting files in the same path that -mix- does/did, so I don't have to modify (for now, a lot of) blade templates
After a few tries, I realized that it's much easier to do it with the plain -vite- config, without involving the laravel plugin (in a new test project, I'll try the actual target project later), but it would be a good enhancement for the plugin
For your last question, that's what this -vite- option emptyOutDir
is for, update your compiled assets without removing anything from external sources
It sounds like you've got a workaround, so I will close this for now. I'm not keen on adding a new configuration option to this plugin and to the framework to mimic Mix. We can always revisit it if another use case requires a different manifest name.
Laravel Vite Plugin Version: 0.5.2 Laravel Version: 9.19 Node Version: 16.16.0 NPM Version: 8.11.0 Vite : 3.0.3 Host operating system: Windows 10 Web Browser & Version: Brave 1.41 (Chromium 103) Running in Sail / Docker: No
Description
Vite allows setting a custom manifest filename https://vitejs.dev/config/build-options.html#build-manifest because the default filename may conflict if you are building a PWA or Chrome extension or whatever
This option is overridden by this plugin (maybe here? https://github.com/laravel/vite-plugin/blob/main/src/index.ts#L105) and always overrides the
manifest.json
fileConfig
Output with laravel plugin
Output without laravel plugin