JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://requirejs.org/docs/release/2.0.6/minified/require.js"></script>
JavaScript
define('Foo', [], function() {
var test = function() {
this.foo = 'foo';
};
return new test();
});
define('Bar', ['Foo'], function(Foo) {
console.log('From bar', Foo);
Foo.bar = 'a';
console.log('From bar', Foo);
});
define('Other', ['Foo'], function(Foo) {
console.log('From the other', Foo);
Foo.bar = 'b';
console.log('From the other', Foo);
});
require(['Foo', 'Bar', 'Other'], function(Foo, Bar, Other) {
console.log('Bringing it all together');
});