magomimmo/modern-cljs

Using your tutorial boilerplate with webworkers?

Opened this issue · 0 comments

rjb25 commented

I have been running on a boilerplate from your tutorials. I recently ran into a problem when trying to use a web worker library due to main.js not being executable by a web worker. main.js looks like:

var CLOSURE_UNCOMPILED_DEFINES = null;
if(typeof goog == "undefined") document.write('<script src="js/main.out/goog/base.js"></script>');
document.write('<script src="js/main.out/cljs_deps.js"></script>');
document.write('<script>if (typeof goog != "undefined") { goog.require("boot.cljs.main8234"); } else { console.warn("ClojureScript could not load :main, did you forget to specify :asset-path?"); };</script>');

Notice that it writes the dependencies to the page. A web worker cannot use this because it needs a single file that contains all of its execution data. Typically this would be the main.js file.

I could use an alternative file that uses importScripts(); alongside goog.require. I am not sure what scripts to import though and in what order. Possibly there is another js file that might do what I am looking for? Any questions of further details you might want please ask.

TLDR; Trying to get your tutorial boilerplate to work with servant web worker library but your main.js file does not work as expected.