On Saturday, May 13, 2017 at 3:47:01 AM UTC+2, Jiyin Yiyong wrote:
> Cool.... Hope one day it's in Lumo too XD

Not by me but the features could certainly be ported.

I spent quite a bit of time yesterday fighting through webpack sources trying 
to come up with an efficient way of doing things.

The easy solution would be to make everything one-way which means JS can 
require CLJS but CLJS cannot require "local" JS, only modules from npm. So 
(js/require "react") would work but (js/require "./foo") would not.

So in JS you would could say var x = require("webpack-cljs/cljs.core"). The way 
things are handled in webpack/npm means you must have a module-name which would 
be webpack-cljs or something along that line. But a package cannot depend on 
the local sources.

Having sources to actually be side-by-side doesn't mirror too well to JS since 
you usually don't have namespaces there.

Imagine
src/index.js
src/foo.js
src-cljs/foo/bar.cljs

In index.js you could say require("./webpack-cljs/foo.bar") and in the cljs 
file I could imagine
(webpack/require "./foo") where it would always be relative context root (ie. 
src). The compiler would actually just generated a src/webpack-cljs/foo.bar.js. 
Same way it would for the module version.

The problem with that is that people may start writing npm packages in CLJS 
where each package would contain its own version of cljs.core. That would be 
really really bad.

Ideally I want
src/index.js
src/foo.js
src/foo/bar.cljs

but have not figured out how to do that yet. webpack has a ton of mutable state 
all over the place so trying to figure out what is going on is not that easy.

I'll probably write the simple version today and see how things work out.

-- 
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