JSFiddle - React, Tailwind, and code Playground
by Matt Swensen
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.15/require.js"></script>
JavaScript
console.clear();
define("Main", [], function() {
return function() { this.opt = "A"; };
});
define("Plugin", ["Main"], function(Main) {
return function() {
Main.call(this);
this.opt = "B";
};
});
require(["Plugin"], function(Plugin) {
console.log((new Plugin()).opt); // should log B
});
require(["Main"], function(Main) {
console.log((new Main()).opt); // should log A
});