• 0

Uncaught Error: Module name has not been loaded yet for context: _. Use require([])

Problem :

Requiring a file using simplified commonJS syntax for example,
var jQuery = require('jQuery');
throws the following error
Uncaught Error: Module name has not been loaded yet for context: _. Use require([])
http://requirejs.org/docs/errors.html#notloaded

Solution :

You need to convert your requires to the normal callback syntax. Read this article for Difference between normal callback vs simplified commonJS
var jQuery = 'jQuery';

// ES5
require([jQuery], function(result){
    jQuery = result;
});

// ES6
require([jQuery], result => jQuery = result;);