Fast rerun and custom widget development

I am working on a custom widget. Each time I update the widget definition (F4 in the modeler), this triggers a full restart of the local server. This is not necessary as only the contents of deployment\web\widgets needs to be refreshed. It would be great if fast rerun also works with widget development. I know I can edit the JavaScript in Chrome, but that only works for minor changes and mostly only with function scoped stuff. And there is the risk of an edit not taken back to the real source.
6 answers

Yes, that would certainly be a great refinement of the 'fast rerun' feature. Let's see if I understand you correctly:

  • You edit the Javascript of a widget outside of the project folder.
  • You create an .mpk file of the widget.
  • You place the new mpk in the widgets directory.
  • You press F5 in the Modeler.
  • You get an ordinary (slow) deployment instead of a fast rerun.

Is that the use case you are talking about?

Update: Yes, I will put both ideas (widgets and theme) on our backlog. First we are fixing that fast rerun does not detect file changes when the Modeler is running inside a VM and the project is located on a drive of the host machine (e.g. a Mac). And we will have another deployment optimizations for you soon...


Finally! Yes! It is now possible to do this in MBM 5.16.1 in deployment in the widget folders in %DEPLOYMENT%/web/widgets

alt text


I use grunt tasks to achieve this. I have my widget source in a separate folder. As soon as I change a javascript file, grunt automatically compiles the mpk and updates my deployment folder. I'm using the similar tasks for theme development.


Hi Marcel,

It is possible to edit your widget in the deployment directory. (within you project \deployment\web\widgets) Now you can just refresh the app in the browser (make sure it does not stick in you browser cache)

But be really careful!! when you restart you application the deployment directory is emptied!! And if you did not copy you changes.... you loos them


Yes this would indeed be nice and is already known, together with many other improvements for deployment. It now becomes a matter of who gets to work on it when though, the fast re-run feature was made during one of our research days (where we just get to work on something nice of our own choosing) but it's not a roadmap feature. Please do file a feature request for it :)


It is also possible to extract all your widgets, write a script that deploys it for you The widgets seem to be deployed to deployment/widgets, but also their codes gets concatenated in some strange, irritating, but doable with batch scrips like this (I wish i knew grunt):

@echo off
erase ..\deployment\web\widgets\widgets.js
erase ..\deployment\web\widgets\widgets.css
set SRCDIR=qwer
echo deploying %SRCDIR%...
rem deployment seems to want it to go into a specific folder
xcopy .\%SRCDIR% ..\deployment\web\widgets  /e /d /y /c /i /q > NUL
copy /y .\%SRCDIR%\package.xml .\src2
rem you need a special extra two lines, its all how this differs, at least for a single widget
echo dojo.provide("widgets.widgets"); >> ../deployment/web/widgets/widgets.js
echo dojo.registerModulePath("%SRCDIR%", "../../widgets/%SRCDIR%"); >> ../deployment/web/widgets/widgets.js
cat ./%SRCDIR%/%SRCDIR%/widget/%SRCDIR%.js >> ../deployment/web/widgets/widgets.js
cat ./%SRCDIR%/%SRCDIR%/widget/ui/%SRCDIR%.css >> ../deployment/web/widgets/widgets.css

The trick is to have all your widgets extracted and do the above for all of them (tgt1, tgt2, etc). Inspect the files in %DEPLOYEMENT%/widget to find out more