I am having an issue with an undefined variable in my module set up, best to explain by example, I have:
common.js (config for requirejs)
require([
'module/polyfills/someModule'
], function(
module
) {
module.init();
});
module/polyfills/someModule.js
define([
'underscore',
'config',
'text!tpl/utils/textTemplate.html'
], function(_, config, template) {
// ref 1
return {
init: function() {
// ref 2
// do stuff
},
events: function() {
// add some events
},
};
});
If I put a breakpoint at the comment ref 1 I can see the config variable and its properties. However if I put a breakpoint at ref 2 then config is undefined. However underscore and the template are not undefined.
I have removed anything special about config in my require configuration. Config looks like this:
config.js
define([], function (clickType) {
return {
clickType: 'test'
};
});
There are no errors in console and I am very certain this is not a circular dependency!
initto your question. - Louis