Test javascript modules in console

Date: 2019-04-23
(() => {
    delete window.require;
    delete window.define;
    const run = () => {
        require.config({ paths: { "callbags": "https://cdn.jsdelivr.net/npm/callbag-basics@3.0.1/dist/bundle" }});
        require(["callbags"], () => {
            const callbags = require("callbags");
            console.log(callbags);
            debugger;
        });
    };
    const js = "https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js";
    const x = document.createElement("script"); x.setAttribute("src", js); x.onload = run; document.head.append(x);
})();
(() => {
    const run = () => {
        debugger;
        //System.config({ paths: { callbags:  }});    
        System.import("https://cdn.jsdelivr.net/npm/callbag-basics@3.0.1/dist/bundle.min.js").then((callbags) => {
            console.log(callbags);
        });
    };

    const scripts = ["https://cdn.jsdelivr.net/npm/systemjs@3.1.6/dist/system.min.js"];
    const d = document;
    for (const script of scripts) {
        const x = d.createElement("script");
        x.setAttribute("src", script);
        x.onload = run;
        d.head.append(x);
    }
})();
21090cookie-checkTest javascript modules in console