figwheel-main

figwheel-main http://figwheel.org
bhauman 2020-05-26T14:28:23.382300Z

@gdanov I’m also available here if you want to talk more about the contains problem

jeff.terrell 2020-05-26T14:37:49.383200Z

Sorry if this has been asked already, but I'm having issues with my Figwheel environment now that browsers don't send cross-origin cookies without the Secure attribute set.

jeff.terrell 2020-05-26T14:38:14.383900Z

(And I'm running stuff on <http://localhost>, not <https://localhost>, so the Secure attribute is a no-go.)

jeff.terrell 2020-05-26T14:38:50.384600Z

I have Figwheel serving my frontend and a backend running in a different process, listening on a different port, so I'm hitting the cross-origin cookie security policy.

jeff.terrell 2020-05-26T14:39:15.385100Z

Here's an SO question I posted yesterday about this. Not about Figwheel per se, but about this issue: https://stackoverflow.com/questions/62013644/how-can-i-bypass-samesite-cookie-restrictions-in-my-development-environment

jeff.terrell 2020-05-26T14:40:00.386100Z

I guess I need to either figure out how to use https on localhost or else bundle the frontend and backend together so that they appear to the browser to come from the same origin.

jeff.terrell 2020-05-26T14:40:07.386400Z

Anyway, anybody figured this out for Figwheel yet?

bhauman 2020-05-26T14:40:29.386900Z

@jeff.terrell hmm this is interesting

bhauman 2020-05-26T14:41:20.387600Z

but the answer here is to have your backend serve your front end

jeff.terrell 2020-05-26T14:41:20.387700Z

Yeah it was a real stumper for me last week. 😅

bhauman 2020-05-26T14:41:48.388200Z

figwheel still runs on localhost to supply reload and repl connection

jeff.terrell 2020-05-26T14:42:21.389100Z

Ah…like start Figwheel and keep it running, but actually access the site via the backend.

bhauman 2020-05-26T14:42:24.389300Z

but you have to compile the files and serve the static files from your backend server

bhauman 2020-05-26T14:42:47.389900Z

https://figwheel.org/docs/your_own_server.html

jeff.terrell 2020-05-26T14:42:47.390Z

OK. Any issues in that case with the cross-origin websocket connection that you know of?

bhauman 2020-05-26T14:42:55.390300Z

nope 🙂

jeff.terrell 2020-05-26T14:43:06.390500Z

OK, fantastic. Thanks very much!

👍 1
dominicm 2020-05-26T14:55:21.391800Z

You may need to configure your csp if you have one

dominicm 2020-05-26T14:55:34.392300Z

Most secure defaults would block access to the Figwheel one

jeff.terrell 2020-05-26T14:56:29.392900Z

I definitely read the "Your Own Server" page before. Is it recommending this approach, to actually load your page from the backend server? If so, I missed it. I thought it was saying that it was fine to load frontend from Figwheel and backend from a separate origin. Anyway…

jeff.terrell 2020-05-26T14:56:46.393400Z

@dominicm - Gonna look into this CSP thing…thanks.

bhauman 2020-05-26T14:58:01.394600Z

@jeff.terrell yeah I just re-read it, I’ll have to have another look at it. It creates a server that serves the whole application including that static assets but its all implicit.

👍 1
bhauman 2020-05-26T14:58:32.395100Z

its definitely not making the point I want to make

jeff.terrell 2020-05-26T14:58:53.395600Z

I'm relieved to hear you say that, so I'm not just missing it. :simple_smile:

bhauman 2020-05-26T14:59:33.396Z

@dominicm what to you mean by CSP?

bhauman 2020-05-26T14:59:59.396300Z

cross site policy?

dominicm 2020-05-26T15:04:21.396400Z

@bhauman yeah. You have to specify where connections are allowed to.

bhauman 2020-05-26T15:04:54.396700Z

oh yeah coming back to me 🙂

2020-05-26T16:18:57.397900Z

Mistakenly posted to #lein-figwheel originally: when figwheel-main fails with a cljs compilation issue - it reports the logs with no stacktrace. is there anyway to get more? example: `[Figwheel:SEVERE] java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol` but no access to more of the stack

bhauman 2020-05-26T16:23:18.398300Z

did you try :log-level :all ?

bhauman 2020-05-26T16:23:29.398600Z

@mikerod ^

2020-05-26T16:26:32.399Z

@bhauman trying it out - no, haven’t configured that option before

2020-05-26T16:27:14.399500Z

I got more output from it being set in other places - but still no stacktrace for the error or more info on the error

2020-05-26T16:27:22.399800Z

I know the error happens during macroexpansion while compiling cljs

bhauman 2020-05-26T16:27:40.400300Z

is it the initial compile?

bhauman 2020-05-26T16:27:50.400500Z

or in the watched compile?

bhauman 2020-05-26T16:28:22.401Z

it seems like the watched compile handles the stacktrace better

2020-05-26T16:29:10.401200Z

initial

2020-05-26T16:29:17.401500Z

can’t compile - have some issue w/ macro

2020-05-26T16:29:23.401700Z

so trying to debug what that issue is

bhauman 2020-05-26T16:29:37.401900Z

hmmm

bhauman 2020-05-26T16:29:53.402200Z

yeah that needs log information

bhauman 2020-05-26T16:30:02.402500Z

let me check that out

2020-05-26T16:34:05.402700Z

thanks

bhauman 2020-05-26T16:35:42.403900Z

but I probably wont have a look at it until tomorrow

2020-05-26T16:38:46.404100Z

that’s ok

2020-05-26T16:38:49.404300Z

I appreciate feedback

2020-05-26T16:39:01.404600Z

I’m trying to dig a bit via the figwheel scripting API

2020-05-26T16:39:03.404800Z

in the repl

bhauman 2020-05-26T16:45:07.405100Z

@mikerod actually I found it

bhauman 2020-05-26T16:45:25.405500Z

let’s see if I can get it in the 0.2.6 release

bhauman 2020-05-26T16:45:53.406100Z

basically whenever I call log/error I need to call log/debug with a stacktrace

2020-05-26T16:54:08.406300Z

nice

2020-05-26T16:54:11.406500Z

yes, that makes sense

bhauman 2020-05-26T16:58:08.407100Z

I’m going to try and release 0.2.6 in the next half hour and it will include this

2020-05-26T17:09:20.407300Z

Very fast!

2020-05-26T17:10:07.407600Z

I’ll try it out though when it’s up

bhauman 2020-05-26T18:05:06.408300Z

@mikerod its up and use :log-level :debug

pyrmont 2020-05-26T18:14:39.408900Z

The new logo is kick ass.

👍 1
2020-05-26T18:28:39.409200Z

nice, I’ll try it out soon @bhauman thanks for quick turnaround

bhauman 2020-05-26T19:54:29.410900Z

@mike858 Thanks! spent the weekend starting to implement a new design from @lubovsoltan

bhauman 2020-05-26T21:00:14.412600Z

figwheel-main 0.2.6 has been released this features a much nicer workflow for using NPM, I’ve started the docs for it here https://figwheel.org/docs/npm.html

👍 4
bhauman 2020-05-26T21:00:34.413200Z

autotesting and extra-mains are supported

bhauman 2020-05-26T21:00:55.413600Z

it logs the bundle command so that you can see when its happening

dominicm 2020-05-26T21:18:13.414600Z

How frequently is it run now?

bhauman 2020-05-26T21:22:16.415200Z

it runs once at the beginning, but if you set :bundle-once false it runs every time

bhauman 2020-05-26T21:22:26.415400Z

@dominicm ^

bhauman 2020-05-26T21:23:28.416400Z

I’m going to add smart bundling based on index.js and npm_deps.js file next and put it behind a flag

👍 1
❤️ 1
bhauman 2020-05-26T21:24:04.416700Z

that should cover all the common cases

bhauman 2020-05-26T21:25:06.417900Z

I’m also thinking of adding a figwheel option :auto-bundle :webpack to handle the most common case so that folks don’t have to configure anything really

bhauman 2020-05-26T21:25:39.418600Z

@dominicm if you get a chance to use it let me know, any feedback is helpful

dominicm 2020-05-26T21:29:57.419Z

I'll probably set it up tomorrow

dominicm 2020-05-26T21:30:22.419500Z

With that and install deps, I've got a pretty nice setup

bhauman 2020-05-26T21:33:48.419900Z

yeah I’d like to see what you’ve set up

bhauman 2020-05-26T21:34:10.420400Z

I’m really looking forward to the $ syntax as that really completes the story

athomasoriginal 2020-05-26T22:28:01.420800Z

Just upgraded some non trivial projects to latest. Works great. Thanks, Bruce!

bhauman 2020-05-26T23:19:01.421200Z

@tkjone awesome! Thanks!

athomasoriginal 2020-05-26T23:19:27.421500Z

Let me know if you want anything tested 🙂

bhauman 2020-05-26T23:19:53.422Z

are you using the :output-to and :final-output-to helpers?

bhauman 2020-05-26T23:20:07.422300Z

@tkjone ^

athomasoriginal 2020-05-26T23:21:38.423200Z

No. I left what I had from the official webpack guide e.g. :output-to and :output-dir. Want me to check them out?

bhauman 2020-05-26T23:33:19.424500Z

@tkjone yeah if you could give the new NPM guide a gander and check if its functionality works for you that would be great https://figwheel.org/docs/npm.html

👍 2
athomasoriginal 2020-05-26T23:52:13.426700Z

Okay, ran through the Quickstart and then the Other stuffs and used the :output-to and :final-output-to helpers helpers. Sleek.

athomasoriginal 2020-05-26T23:52:41.427200Z

Given my assumption is that the people using this are anywhere from early learners -> experienced developers these are some of the items I might enhance:

athomasoriginal 2020-05-26T23:59:53.432400Z

Quickstart • Maybe because the title of the section is smaller, I did not immediately realize it was an official quick-start 😆 • If people are coming from the official webpack guide -> this guide they might trip up around the fact that they don’t have to specify the output-to and output-dir • Linked to the above bullet, I only realized after reading the Figwheel message in the command line that the file output by webpack is called main_bundle.js as opposed to main.js . This is partly from following the official guide and quickly adapting it to your guide. Maybe adding a quick note about the name of the file output in the quickstart section could be helpful :thinking_face: • The yellow comment block in the quickstart is super helpful, but I had to re-read it a few times to fully grok what I think is the suggestion: if you happened to have specified an :output-dir please make sure that :output-to is updated accordingly.