Fork me on GitHub
#figwheel-main
<
2018-08-15
>
dnolen13:08:45

does figwheel support running some other shell thing first, i.e. webpack?

bhauman14:08:49

@dnolen not yet I was just thinking about hooks just this moment

bhauman14:08:48

its always a balance since the scripting api is there now, I wonder about initialization hooks should even be offered.

bhauman14:08:17

and because clj -init is a thing it seems a bit redundant

bhauman14:08:44

but I was thinking about hooks that occur before and after each build

bhauman14:08:59

@dnolen and actually its a bit tricky because yarn requires a tty and so you have to do (clojure.java.shell/sh "sh" "-c" "yarn webpack")

bhauman14:08:03

@dnolen if you think an initialization hook is worth it to automate things like webpack let me know

dnolen14:08:13

I think I’m leaning towards not for now

dnolen14:08:16

might revisit this later

bhauman14:08:14

@dnolen you did see the new :npm option?

dnolen14:08:02

@bhauman that’s interesting but it assumes the index.js will be easy to understand semantically

dnolen14:08:56

I’ve run into cases where it’s better to not just reassign the import but to put the import into an object with some other name(s)

dnolen14:08:07

and of course other users may want to do something dynamic and then game over

dnolen14:08:31

@bhauman not dynamic, but an example of what I’m talking about from my class

bhauman14:08:18

@dnolen its just reading the window. statements

bhauman14:08:01

so it should work in this case right?

dnolen14:08:28

you don’t read the imports to compute the :provides?

dnolen14:08:03

and how do you line them up?

bhauman14:08:34

the porvides are the keys of the global exports in this case

bhauman14:08:43

is that to naive?

dnolen14:08:05

in my above snippet

dnolen14:08:16

how would you figure out the global exports for moment

dnolen14:08:28

or DatePicker

dnolen14:08:17

I’m not saying it can’t be done - but it needs to handle a lot of cases

dnolen14:08:22

and it won’t work if index.js is dynamic

bhauman14:08:47

yes its for the simple common case right now

dnolen14:08:05

right I’m just skeptical about the common case 🙂

dnolen14:08:10

this is a date picker

bhauman14:08:39

{:provides ["moment" "react" "react" "react-date-picker"], :global-exports {moment moment, react ReactDOM, react-date-picker ReactDatePicker}, :file "out.js"}

bhauman14:08:53

thats what my code produces

dnolen14:08:59

what about scoped modules?

dnolen15:08:17

in anycase I’m on a client project right now where this stuff comes up and it’s basic stuff they want

bhauman15:08:32

yeah I beleive it

bhauman15:08:39

its very simple sugar

bhauman15:08:59

that's why I didn't try to make it any more sophisticated

dnolen15:08:17

k, yeah I wouldn’t use something like that yet - I’m waiting to see more patterns in the wild

dnolen15:08:28

and then maybe can formulate a better sense of what can be automated here

bhauman15:08:59

absolutely, if at all

bhauman15:08:49

does the output look right though?

bhauman15:08:32

actually it doesn't look right at all to me

dnolen15:08:26

@bhauman like I said I don’t see how it could work for my example

dnolen15:08:36

you have to map from import to export to compute global exporst

bhauman15:08:10

I see what you are saying

bhauman15:08:29

yeah this is too naive

alvina16:08:39

i love :npm in figwheel-main on 0.1.8-SNAPSHOT, long live @bhauman

alvina16:08:14

i have question, does it load 2 instance of react as one from reagent and one from webpack?

alvina16:08:24

as i didn't know how, both technology blend together, i have this question on my mind for long.

bhauman17:08:31

@rumaysaalvina2 you would need to exclude the react from Reagent

alvina17:08:15

thanks a lot again.

bhauman19:08:54

I'm adding a new feature called :extra-main-files that will make it trivial to add tests and devcards to a single build process. You could also add an admin build in there as well.

defn20:08:05

@bhauman Are there instructions for devcards and figwheel main? I found some for figwheel and leiningen. I don't know how to apply that to figwheel main and clj/clojure

bhauman20:08:19

no explicit instructions yet, but it should be the same for the most part. I will provide explicit instructions in the future after I get this feature in place

bhauman20:08:02

but before that I'm going to add more features to make testing trivial and then I'm going document how to test

defn20:08:09

Thank you. I got back to ClojureScript after finding out about figwheel main. It makes sense to me and all the new work I eagerly try out.

👍 4