invaders-xx / filament-jsoneditor

MIT License
22 stars 15 forks source link

Uncaught ReferenceError: JSONEditor is not defined #8

Closed a-zog closed 2 years ago

a-zog commented 2 years ago

Hi,

Thank you again for this great plugin, unfortunately, version 0.4.4 displays an error on both Array and Objects.

Uncaught ReferenceError: JSONEditor is not defined

Is there a way to fix this, it didn't work even with a yarn dev.

Thanks again

invaders-xx commented 2 years ago

There is a pending PR to solve this. Should be merged today

michabbb commented 1 year ago

@invaders-xx hi there, i am using vite and tried everything, I also get this error by random. it looks like the filament-page gets loaded before the browser loead the jsoneditor js files. my guess is, because the main scripts get loaded at the end of each page:

image

do you have a suggestion here ?? thanks !!

tim-massey commented 1 year ago

I am also experiencing this. It works with a full page refresh, just not when navigating between views/pages.

Edit: I am able to resolve it by manually copying the .js and .css assets into public/filament/assets. When I published using ./artisan there is a message:

Can't locate path: </source/vendor/invaders-xx/filament-jsoneditor/src/../resources/dist>

hackel commented 1 year ago

I am also experiencing this on a new install (v0.4.7), and doing a full refresh doesn't solve it either.

I noticed that this step of the install instructions fails:

> artisan vendor:publish --tag=filament-jsoneditor-img

   INFO  No publishable resources for tag [filament-jsoneditor-img].

The request for http://localhost/filament/assets/invaders-filament-jsoneditor.js is successful, and the window.JSONEditor object exists.

I tried @tim-massey's suggestion of copying the files into public/filament/assets, but that made no difference.

@invaders-xx Do you have any ideas?

invaders-xx commented 1 year ago

I don't understand what's happening, I will check that

invaders-xx commented 1 year ago

I tested it and I don't experience any of those issues. Can you please share some information about your technical environment, PHP version, filament version ...

invaders-xx commented 1 year ago

@hackel, I published a new 0.5 version that should fix your issue