Requirejs: paths vs map -


trying understand it's right use "map" wildcard vs "paths".

looking @ require source (but not being 100% fluent it) seems there functionally no difference between these 2 snippets. true?

using paths:

  require.config({     baseurl: "include/js/",     paths: {      foo: "stuff/foo",     }   }); 

using map:

  require.config({     baseurl: "include/js/",     map: {      '*': {foo: "stuff/foo"},     }   }); 

from requirejs docs "in addition, paths config setting root paths module ids, not mapping 1 module id one."

this means "paths" meant mapping path resource when not in default location (baseurl). guess trying do.

on other hand, "map" can have several versions of resource (foo1, foo2...) can map loaded different paths (i.e. want load foo1 desktop browser , foo2 modification of first 1 mobile browser).

so, unless have different versions of foo use "path" although right , "map" work in case.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -