Hi all,
Some of you might have seen the basic widget that Finaps released last week, using Webpack & React. Although this is a nice PoC, including React in custom widgets is not advised. There has already been some discussion around it, which boils down to this: R&D is working on Plugin Widgets, which use React and will eventually replace all the current components (like Buttons etc). We will be able to create our own plugin widgets at some point, but that's still uncertain when. In the meantime, Custom Widgets will not be able to use React. Sad, but true. Including React is a bad practice, as the widgets.js file will include multiple versions of React (the same problem as with jQuery).
Anyway, the Webpack setup that Finaps created inspired me to create my own version of it. You can find it here:
https://github.com/JelteMX/widget-base
This widget setup will create minified code that works in any production environment. Furthermore, it will make the code much smaller (initial tests on ChartJS reduce the size with approx. 50%). Writing ES6 code is prettier, in my humble opinion. Also, this setup will make it possible to start writing code in Typescript (not supported at the moment). Combining it with Gulp to improve the workflow.
I would love to see some feedback on it. Pull Requests & Issues please :-).
If it is deemed stable (it works perfectly for me on a Mac, but need further testing on Windows), I will release it under the Mendix organization, write documentation (the README is small as of now, but covers the important points) and add it to the widget generator.
Happy coding!