I’m building a PlayCanvas application that uses a npm dependency (managed via webpack) and some ClojureScript code (managed via Figwheel). Both build tools pull in a lot of transitive dependencies, so that it is impracticable to copy the sources over to the PlayCanvas code editor.
It would be great, if PlayCanvas would provide an option to add custom script tags to the html file of a PlayCanvas project.
You could add them programmatically in one of your scripts, or use Ajax requests to include them. Just make sure you use HTTPS otherwise when you publish you might face some cross origin request errors.
Thank you for your answer. I already add them programmatically, which works fine for the npm dependency. But ClojureScript uses Google Closure underneath and this one uses document.write to include further JS files. However document.write is not possible anymore, when the document is already loaded / in the ready state. Libs like https://github.com/krux/postscribe provides workarounds for this.
It is still very difficult to make this work with FigWheel, since it has a very interactive development workflow. An option to include an additional script tag in the main html header would make PlayCanvas + FigWheel easy to use.
At the moment I either have to compile the ClojureScript into one JS file or download the PlayCanvas project, add the two JS script tags to the index.html and start a http-server to serve the PlayCanvas project on localhost.
I’m building a cardboard experience that also shows a video ad. The ad is loaded from an ad server that delivers a VAST ad tag. For this purpose I’m using this library: https://github.com/dailymotion/vast-client-js it has quite a few dependencies. I’m writing the other necessary integration logic in ClojureScript.
We don’t really support ClojureScript for the Editor. We used to support custom URLs instead of scripts but for various reasons we dropped support for that.
Our complete system is written in Clojure / ClojureScript therefore we try to use it wherever possible to reuse knowledge, tools and code. By compiling into one JS file I can work with PlayCanvas plus ClojureScript. But I don’t have support for source maps and no live coding (Figwheel).