Skip to content

Instantly share code, notes, and snippets.

Created September 20, 2013 13:00
Show Gist options
  • Save anonymous/6637121 to your computer and use it in GitHub Desktop.
Save anonymous/6637121 to your computer and use it in GitHub Desktop.
I can`t do this work! I would like to use multiversion with separate files. Main execution should alert "1.1" and the "1.2", but I obtain "1.1" always. ¿Anyone know how to accomplish that? I'm lost... :-/
(function(root){
root.foo = {
VERSION: '1.1'
}
}(this));
(function(root){
root.foo = {
VERSION: '1.2'
}
}(this));
require.config({
context: null,
paths: {
foo: 'foo-1.1'
},
shim: {
foo: {
exports: 'foo'
}
}
});
require(['foo'], function(foo){
alert(foo.VERSION);
require(['mymodule'], function(mymodule) {
alert(mymodule.VERSION);
});
});
define('main', function(){});
require.config({
context: 'test',
paths: {
foo: 'foo-1.2'
},
shim: {
foo: {
exports: 'foo'
}
}
});
define('mod',['foo'], function(foo) {
return {
VERSION: foo.VERSION
}
});
define('mymodule', ['mod'], function(module){
return module;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment