The original topic [1] was about bringing CLJS to JS devs.

This is about the other side of the equation: JS for CLJS devs.

That is to say using npm/webpack to generate what we currently do manually or 
via CLJSJS packages.

It is my planned alternative to :foreign-libs. It is not official behaviour and 
CLJS itself does not support that. Time will tell whether we can make this 
official.

See:
https://github.com/thheller/shadow-devtools/blob/master/src/dev/demo/browser.cljs
https://github.com/thheller/shadow-devtools/blob/master/out/demo-browser/bundle.js
https://github.com/thheller/shadow-devtools/blob/master/out/demo-browser/webpack.config.js

The demo.browser CLJS ns just has a :require for npm.react.

To make this work I just generate simple stub files to mimic any npm.* 
namespaces.

For the :browser target this looks like:

goog.provide("npm.react");
npm.react = window["npm$modules"]["react"];

The window["npm$modules"] is then provided by a js file created by webpack. My 
plan is to automate the webpack config/bundle.js generation, but manual works 
just fine for now.  

For the :npm-module, :node-script or :node-library targets this just generates

goog.provide("npm.react");
npm.react = require("react");

So it works without additional configuration for those targets. :browser is the 
only one that needs special processing.

I'll make an official proposal once I have moved this into my production app 
and can prove that it is a viable :foreign-libs alternative while also solving 
most of the issues with that. 


Stay tuned.


[1] https://groups.google.com/d/msg/clojurescript/AGXku7Ous0Y/qkdvVQR_BgAJ

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to