vanilophp / admin

Vanilo Admin Module
MIT License
6 stars 2 forks source link

Vite compatibility #2

Closed jan-edge closed 2 years ago

jan-edge commented 2 years ago

The appshell js and css is not loading with Laravel 9 Vite. The doc instructions are for Laravel Mix, but this is replaced with Vite since Laravel 9.

The following setup instructions won't work:

// webpack.mix.js
mix.js('resources/js/app.js', 'public/js')
// Add these 2 lines:
.js('vendor/konekt/appshell/src/resources/assets/js/appshell.standalone.js', 'public/js/appshell.js')
.sass('vendor/konekt/appshell/src/resources/assets/sass/appshell.sass', 'public/css')
// Keep this for the "rest" (usually public frontend)
.sass('resources/sass/app.scss', 'public/css');
fulopattila122 commented 2 years ago

No bandwidth here for this as of now (we're still using Laravel Mix), but a PR for Vite would be more than welcome :pray:

fulopattila122 commented 2 years ago

@jan-edge this could be a great starting point: https://christoph-rumpel.com/2022/6/moving-a-laravel-webpack-project-to-vite

yasirmturk commented 2 years ago

+100

fulopattila122 commented 2 years ago

Please be aware that Mix hasn't been completely replaced. Yes, Vite is the new default, but it has only been added to Laravel v9.19.

Mix is still there, even the doc says that there's a back and forth migration path between the two: https://laravel.com/docs/9.x/vite#vite-or-mix

Therefore, if any of you feels Vite is vital for your application, you can do it yourself; there's nothing Vanilo-specific. It's plain old SASS to CSS compilation and JS bundling, after all.

There's an official guide: https://github.com/laravel/vite-plugin/blob/main/UPGRADE.md#migrating-from-laravel-mix-to-vite and I'm also linking Christoph Rumpel's blogpost that guides you through the same: https://christoph-rumpel.com/2022/6/moving-a-laravel-webpack-project-to-vite

If you manage to migrate, it would be great if you could extend the Vanilo Documentation with Vite instructions (keeping Mix intact) and send a pull request.

Thank you