1

I searched almost all possible joomla forums to integrate a SPA with joomla 4. I have a SPA with react ready and I want to display it on the administrator side as a component. The only problem is the bundled react files dont seem to give out any output when added like this $webasset->useScript('path/to/media/script'). Can someone help me regarding this issue. The react app runs properly as a standalone but the problem only occurs when integrating with joomla.

3
  • I'm assuming you have registered the JS? $webasset->registerScript('foobar', 'com_foobar/file.js'); Sep 30 '21 at 4:59
  • @GlennArkell I have put it in joomla.asset.json do i need to register it like this too? Oct 1 '21 at 5:42
  • I have never used joomla.asset.json and this is beyond my knowledge, but I would have thought that joomla.asset.json would be related to the core and therefore not a good thing to "mess" with when enhancing your own "stuff". If I add any additional scripts or stylesheets for that matter within my J4 extensions, I always register as described above and then use. This link - docs.joomla.org/Special:MyLanguage/J4.x:Web_Assets - may help you and also by using this process will stand you in good stead for J5. Oct 2 '21 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.