javascript - RequireJS R.js not seeing dependent require files if assigned to a variable in a nested require -



javascript - RequireJS R.js not seeing dependent require files if assigned to a variable in a nested require -

i'm having problem r.js finding file dependencies on nested require calls.

if pass require array of strings, compressor works fine , file dependancies found.

define([ 'jquery', 'underscore', 'backbone' ], function() { require(['views/mobilenavview']); // works fine! });

if pass require array of strings i've assigned variable, compressor doesn't find file dependencies.

var requiredfiles = [ 'views/mobilenavview' ]; define([ 'jquery', 'underscore', 'backbone' ], function() { require(requiredfiles); // doesn't work! });

what causing compressor not find file dependencies if assign array of strings variable?

here app.build.js

({ baseurl: '.', findnesteddependencies: true, mainconfigfile: 'main.js', name: 'main', out: 'core.js', optimize: 'none' })

that's mentioned , explained on r.js docs page

(...) so, not find modules loaded via variable name:

var mods = somecondition ? ['a', 'b'] : ['c', 'd']; require(mods);

that's because r.js scans scripts text, doesn't evaluate them. take @ source code, you'll see there's lot of regular look matching going on.

javascript requirejs r.js

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -