(function() { Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. alert("Using ESM import/export syntax"); The cookies is used to store the user consent for the cookies in the category "Necessary". The require() function is available on NodeJS only but if you want it to be used on the browser you have to add the require() function on the browser by using the ReactJS library. Now our index.js and another-file.js can use the ES6 imports/exports syntax.. Our index.js file exports a function and a variable. r.js v2.1.14 (it works in <=2.1.13)jquery v2.1.1. requirejs.config ( { baseUrl: 'js/lib', paths: { // the left side is the module ID, // the right side is the path to // the jQuery file, relative . Look for files that are 0 bytes. --js }); .js files are treated as ES modules when the module type is specified in Node. In this article, well discuss how to fix uncaught referenceerror: require is not defined javascript. http://nodejs.org/. --mage , - , - ( ). Here in the above example, main.js is loaded after require.js. Create an HTML file and load the script. scripts Finally, you may also remove the data-main attribute and add the Bhavnagar HQ 305, Victoria Prime, Near Water Tank, Kaliyabid, Bhavnagar, Gujarat, India - 364002, Ahmedabad Branch 411, Arista Business Space, Sindhu Bhavan Marg, Bodakdev, Ahmedabad, Gujarat, India. Yeah, I'm using AEM 6.5.3 I tried to add a colorpicker plugin for RTE, @asutosh Tried underscore as well but no luck. If so, feel free to mention them in the Comments section below. The problem I am facing is that, I have already defined the function, still its giving function not defined.ACtually there used to be 1 function in a script, but now as I have added another one, the first one is not working and saying :-Uncaught ReferenceError: function is not defined. You've reached Level 2, to gain points, level up, and earn exciting badges like the new, https://stackoverflow.com/questions/13556010/referenceerror-is-not-defined, Path to your library included is not correct. @Alessandro77, could you provide a content of requirejs-config.js file, or even a few lines of code around 356 line. The JavaScript require() function is only available by default in Node.js environment.