last day (14 days later) » 

7:19 AM
0
Q: No Define call for backbone

AnenthI have a backbone + requirejs app. I am getting this No Define call for backbone in IE8 I have enabled enforceDefine for app support in IE8 Require Config file define([], function(){ require.config({ enforceDefine : true, shim: { "underscore": { deps: [], exports: "_" }, "ba...

 
As far as i remember there is no need to wrap in define require config
 
i got an error saying no define for config file.
 
have u unwraped it from define([], function(){ ....}) ?
 
Yes i had. which had resulted in no define for config file Error
 
do u use anywhere require('config') or define(['config'], function...)
 
7:19 AM
yes am define(['config'], function...)
 
there is no need in this. usually config file is loaded as data-main with <script data-main="config" src="require.js">. You should not mention it as dependencies for any AND modules.
 
7:31 AM
Hi
but config file doesn't load up the app
 
One of common practics of using requirejs is create config.js, there should be nothing then require.config() call. this file is loaded by data-main attribute in script tag you include require.js library on the page. in require.config you can use deps: [] with array of the modules should be loaded as deps on config load
ussually in deps array are mentioned such stuff as application entery point, libraies and so on
 
I have a app file which require the config and main boot file of the app.

define(['config', 'main'], function(){
});
i had changed the require -> define coz i had set enforeDefine to true
 
7:46 AM
what is main?
anyway, it doesent really matter. You have to remove config and main from app file and add deps: ['main', 'app'] into require.config() and unwrap it from define. that should help
 
main is just boot up file. it create the router
okay. thanks
when i remove define from config file am getting dropbox.com/s/tdv2ef6h891x22y/…
 
keep in mind following chain require.js ---loads by data-main---> config.js ---loads by deps: []---> app.js --- loads by define([] ---> routers, models, views and other deps
looks like you forget to remove config from some 'define([])'
no modules should have 'config' in define dependencies array
 
8:39 AM
I am still getting no define call for config. i don't have any config on define([])
 
 
3 hours later…
11:18 AM
then final trick or hack :)- load require lib without data-main, then just after script tag include <script>require.config(.. )</script> but without 'config' in deps array
 

last day (14 days later) »