VarunAgw Posted January 6, 2021 Share Posted January 6, 2021 I have this file "applications\abc\dev\js\admin\controllers\configuration\ips.configuration.form.js" which I load via $form = new Form('form', 'save', NULL, array('data-controller' => 'abc.admin.configuration.form')); Now I face some problems: 1. When I turn off dev mode, the file doesn't load at all. 2. Sometime it loads, but it keep showing the old cached version. 3. I compile it and then create a new version. After that, I upgrade the production with the new archive. But production doesn't load the JS at all. I have to enable dev mode in production, compile JS, and clear cache in support page several times, and then it works. How to fix this strange behavior? Link to comment Share on other sites More sharing options...
bfarber Posted January 6, 2021 Share Posted January 6, 2021 You have to ensure the js is loaded. In your controller you do something like this, adjusting the filename as appropriate. \IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery' ) ); Here you'd change "browse" to the javascript controller location, and "gallery" to your application key. Link to comment Share on other sites More sharing options...
VarunAgw Posted January 11, 2021 Author Share Posted January 11, 2021 @bfarber I have tried that, but still JS resources doesn't load in production when upgraded. Link to comment Share on other sites More sharing options...
bfarber Posted January 11, 2021 Share Posted January 11, 2021 What line did you add to your controller generating the page, exactly? What is the controller name, and what is the path to the javascript controller you are attempting to add? Link to comment Share on other sites More sharing options...
Recommended Posts