whitecube / nova-flexible-content

Flexible Content & Repeater Fields for Laravel Nova
MIT License
788 stars 228 forks source link

LaravelNova is not defined #391

Closed jakubmikita closed 1 year ago

jakubmikita commented 1 year ago

After upgrading Nova to 4.15.0.

The error can be seen in console right after accessing Nova, nothing renders in the body

The issue has been introduced in version 1.0.3, it works in 1.0.2

image

voidgraphics commented 1 year ago

Sounds related to #387, @mikaelpopowicz do you know what could cause this?

mikaelpopowicz commented 1 year ago

Hi @voidgraphics I'll investigate

mikaelpopowicz commented 1 year ago

Hi @Kubitomakita

You may run the php artisan nova:publish command to publish the missing public/vendor/nova-kit/nova-packages-tool folder.

In addition you may add the following command under script.post-autoload-dump in your application's composer.json file :

{
  "script" : {
    "post-autoload-dump": [
      "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
    ]
  }
}
KasparRosin commented 1 year ago

@Kubitomakita Also make sure that your public/vendor/ folder is not ignored.

I had that issue few weeks ago, where I had published the assets, but because I was not specifying which vendor folder to ignore, it was ignoring all vendor folders in the probject, including the one in public/vendor

jakubmikita commented 1 year ago

@mikaelpopowicz @KasparRosin sorry for the late response. It doesn't work, we're already publishing this package. Assets from nova-kit/nova-packages-tool simply doesn't publish.

image

It might be because your package is loaded by another Laravel package, like this: App <- Package X <- Nova Flexible Content

EDIT: More than that, there's no attempt to download this public file. Script is not in the source files nor in the requests image

EDIT2: Only after explicitly adding NovaKit\NovaPackagesTool\LaravelServiceProvider::class, to the providers list it fixes the issue and publishes the asset. I think it's a bit of a drawback, you should at lease include it in the installation docs.

mikaelpopowicz commented 1 year ago

Hi @Kubitomakita

Thank you for the report.

It's weird because the NovaKit\NovaPackagesTool\LaravelServiceProvider::class should be autoloaded by the auto discover package command.

Do you have the @php artisan package:discover --ansi command inside the composer post-autoload-dump script section ?