Fork me on GitHub
#cljs-dev
<
2019-05-13
>
mfikes15:05:34

I don't have a whole lot of experience with https://clojurescript.org/guides/webpack but one thing I've been wondering is whether it is possible to automate it a little more, perhaps with new compiler options along the lines of :webpack-deps or somesuch. This is really a question I have based on my current level of ignorance on the subject. Perhaps the right thing to do would be to explore such ideas outside of the compiler proper, via some "main-style, clj alias-driven programs" to even see how far automation and simplification can be taken. (And perhaps there are corner cases that thwart this idea, where you really need a human to set up the relevant files, etc.)

đź’Ż 4
lilactown15:05:42

I don’t have much experience using webpack with CLJS either. But I think having something that worked like create-react-app w.r.t. project configuration and scaffolding, that was a dependency that could be bumped / overridden / “ejected”, would be most excellent

dnolen15:05:53

@mfikes Figwheel actually already does this - but it doesn't work in general

dnolen15:05:07

which is why I didn't really bother in the first place

dnolen15:05:50

again if a library chooses a structure that's incompatible w/ ClojureScript namespaces there's not really an automatic way to handle that

mfikes15:05:43

Ahh, the src/js/index.js is near impossible to automate...

dnolen15:05:54

yes, again can work for React

dnolen15:05:57

but it can't work in general

dnolen15:05:15

and certainly if you start getting to fancier React modules game over

dnolen15:05:23

those need stylesheets, assets etc.

dnolen15:05:54

so I would say our current Webpack approach is minimal - but it always works

dnolen15:05:11

it's takes a most a couple of days getting used to and you're off to the races

dnolen15:05:33

I do think better docs, better errors are in order for more intermediate/advanced use cases

mfikes15:05:47

Makes me wonder if you had some tooling option somewhere that accepted :webpack-index-js (and punted to you to make that file), if the rest could be automated. Dunno. Again, ignorance is my problem. 🙂

dnolen15:05:29

modules don't describe their structure so they can't really be inferred

dnolen15:05:50

and I don't know how you can infer stylesheets, assets, etc.

dnolen15:05:00

and those also require editing webpack.config.js

dnolen15:05:14

JS is a mess

dnolen15:05:18

there's no magic way to fix it

dnolen15:05:50

to me create-react-app is just showing how much of disaster the situation really is

mfikes15:05:16

Cool cool. I think the problem I have is, when you look at https://clojurescript.org/guides/webpack where, if you don't know much about it, the example on that page looks almost automatable. But the devil is in the details if you start using it in anger and you see the corner cases.

dnolen15:05:31

that's right

dnolen15:05:55

but you only think that if you haven't used JavaScript - which is I admit a significant demographic of people who want get things done

mfikes15:05:14

I fall in that group 🙂

dnolen15:05:09

yeah, but I think the problem is like that of :npm-deps

dnolen15:05:18

too many edgecases

mfikes15:05:32

Indeed. :npm-deps makes things look simpler than they are in reality

dnolen15:05:35

and too much expectation about what can be solved

dnolen15:05:29

it's probably worth exploring in some external tool - but I don't think we should pursue more automation here in ClojureScript proper unless we have some new big insight into the problem