How to Fix "Uncaught ReferenceError: richEditorFormComponent is not defined" After Hosting?
Hi, does anyone know about this? Everything works fine on localhost, but when I deployed it, I got the error :
"Uncaught ReferenceError: richEditorFormComponent is not defined at [Alpine] richEditorFormComponent({ state: $wire.$entangle('data.body', false), }) (eval at safeAsyncFunction...."
I've tried upgrading Filament, running composer update, and other steps, but the RichEditor still doesn't work after deployment. Other components are working fine. Thanks

Solution:Jump to solution
wow, anyway, i've successfully solved the issue. Thank you for responding to me before🙏. I tried deleting the assets directly from the server and then ran php artisan filament:install --forms and php artisan livewire:publish --assets😁
24 Replies
Check your DevTools console. Sounds like some of your JS files are missing or have bad content
Or try running
php artisan filament:assets
I've also tried it, but it still doesn't work😞. It might be because alpine.js is not loaded properly

you could try
php artisan vendor:publish --force --tag=livewire:assets
this publishes livewire assetsYeah I would check your resources folder for overrides
okaa I've already tried that, but the error is still the same🙏
php artisan storage:link?
yes ,i've tried running that 😞
have you checked your network logs for the .js and compared the two?
Any JS customization? Custom theme, app.js, .. ?
it looks good all the .js files are returning status 200
no i haven't made any customizations to the JS files or theme. Everything is still using the default setup
oh, but I did make styling customizations using extraAttributes() in the RichEditor component to set a minimum height
Is it a Filament resource or custom page?
it's a filament resource and here is the code

Did you check the actual result? Is it Javascript? Servers can return 200 but still deliver different content
yes ive checked, the response shows that the content returned is js. here, I added a screenshot or did i miss something?

Have you compared it to the local version?
ohh wait lemme check again
in my local version, the rich-editor file is there, but on the hosting, it's missing😔. Looks like the file isn't there, as you can see above

Exactly... There is your issue
So Run
php artisan filament:assets
Also ensure to run npm run build
oh, okaa the only thing i haven't tried is npm run build before, but after did it i got an error saying that "EMFILE : too many files open". Does this mean i need to increase the number of file descriptors?

Hi, anyway, I've finished running npm run build, but the same issue still persists. Any advice? I also tried redeploying, but it's still not working. When I try to access it manually, like at https:/**/js/filament/forms/components/rich-editor.js, the rich-editor file exists (it's uploaded to the folder where I'm hosting it). However, I don't know why it's not loading properly on the web
That's very strange
Can you check the files in the
public/js/filament/forms/components
folder?yess on my local and hosting server


Solution
wow, anyway, i've successfully solved the issue. Thank you for responding to me before🙏. I tried deleting the assets directly from the server and then ran php artisan filament:install --forms and php artisan livewire:publish --assets😁