” in my index.html and I know this is working because I see that it is loaded in the ‘Network’ tab of Chrome dev tools (see screenshot below). I’ve tried delaying it by putting it in a MicroflowTimer widget. I’ve also tried including the delay in the js code using “$(window).on('load', function() {...}”. So maybe it’s not a timing issue where it is loading before require. But maybe require is not available to this script. Are there any other steps I need to do when including js libraries so that the HTMLSnippet widget can access/reference it? Note: I also tried including the custom js code in a file and putting that in index.html right after require loads. But I get the same error.  "> ” in my index.html and I know this is working because I see that it is loaded in the ‘Network’ tab of Chrome dev tools (see screenshot below). I’ve tried delaying it by putting it in a MicroflowTimer widget. I’ve also tried including the delay in the js code using “$(window).on('load', function() {...}”. So maybe it’s not a timing issue where it is loading before require. But maybe require is not available to this script. Are there any other steps I need to do when including js libraries so that the HTMLSnippet widget can access/reference it? Note: I also tried including the custom js code in a file and putting that in index.html right after require loads. But I get the same error.  "> ” in my index.html and I know this is working because I see that it is loaded in the ‘Network’ tab of Chrome dev tools (see screenshot below). I’ve tried delaying it by putting it in a MicroflowTimer widget. I’ve also tried including the delay in the js code using “$(window).on('load', function() {...}”. So maybe it’s not a timing issue where it is loading before require. But maybe require is not available to this script. Are there any other steps I need to do when including js libraries so that the HTMLSnippet widget can access/reference it? Note: I also tried including the custom js code in a file and putting that in index.html right after require loads. But I get the same error.  ">
Require.js not imported/loaded/available to HTMLSnippet widget or index.html - Mendix Forum

Require.js not imported/loaded/available to HTMLSnippet widget or index.html

0

Using the HTMLSnippet widget I am running some javascript with JQuery. The code is require.config(); but I get “TypeError: require.config is not a function”. I’ve included “<script src="javascript/require.js?"></script>” in my index.html and I know this is working because I see that it is loaded in the ‘Network’ tab of Chrome dev tools (see screenshot below). I’ve tried delaying it by putting it in a MicroflowTimer widget. I’ve also tried including the delay in the js code using “$(window).on('load', function() {...}”. So maybe it’s not a timing issue where it is loading before require. But maybe require is not available to this script. Are there any other steps I need to do when including js libraries so that the HTMLSnippet widget can access/reference it?

Note: I also tried including the custom js code in a file and putting that in index.html right after require loads. But I get the same error.

 

asked
1 answers
1

Since mendix uses AMD pattern for widgets, (that architecture has require function as framework default) so it must be getting the reference of that!
When you run the app, open the browser and go to browser console, and simply type console.log(require) or console.info(require) see what object you get.
My doubt is, it is referencing the dojo frameworks require function. but i could be wrong.
then again i am not sure what are you accomplishing by adding requirejs libraries?

answered