Widget working locally but not in the cloud

3
I wrote a small Markdown to HTML converter widget, based on the Showdown converter. Magically, it works locally, but not in the cloud. I get the error "showdown.Converter is not a constructor". My assumption is that it cannot find my lib file to which I refer in the require: require([ blablabla "Showdown/lib/showdown" ], function(blablabla, showdown) { Do you have any idea what can cause this? Is the relative path to a lib file read differently in the cloud? Otherwise, would there be a good practice to refer to the CDN-hosted lib file instead of having it in the widget? The source code can be found here: GitHub
asked
4 answers
4

Try to enable bundling of widgets on the local machine. This is under project settings and modeler. Are you using any minified libaries because this can usually cause a problem when deploying to the cloud.

After looking at your source code, I can see that you are using a minified showdown library. Use a non minified library and this should fix the problem.

answered
2

Based on your gitHub code, it looks like you're using the showdown minified file. Try a non-minified version instead. For a discussion on this same matter and an explanation about why it won't affect your app's performance, see here:

https://forum.mendix.com/questions/21452/Why-do-minified-versions-of-libs-break-after-being-bundled

answered
1

For testing purposes, you could enable "widget bundling" locally in your project settings.

answered
0

It could be the fact that your Showdown is in capitals and your folder is in lowercase. The Mendix cloud is case sensitive because it runs on a Linux environment whereas running locally is on windows, which isn't case sensitive. It could be this or the way your importing the libary as require is no longer the preferred method of including libraries. See the boilerplate for an example of including additional libaries: https://github.com/mendix/AppStoreWidgetBoilerplate/blob/master/src/WidgetName/widget/WidgetName.js

answered