Fork me on GitHub

How do I start up a dev http server that supports a specific set of CORS headers? From the userguide I tried adding in :push-state/headers element into the :devtools config but had no effect? All I need is for the dev server to offer a single index.html page with specific CORS support so my re-frame app can login via aws-cognito


can you point me to the AWS docs that explain the CORS headers needed? I don't understand why it is needed?


I’m writing a serverless app that will allow user to login via aws cognito over ajax, then it will call several lambda fns via api gateway, that is the plan. For development on my local machine, I need to allow the browser to post ajax to aws, hence the cors. I’m sure there are possible routes for logging in, but for accessing api gateway I definitely need cors.


If there is no way at present to simply tell devtools to inject cors headers into responses, then I will add a small handler to do this for me, but thought I would ask, as most things seem to have been thought out already


hmm maybe I'm missing something but you posting against some AWS host does not require CORS locally?


Sorry if I’m not clear. I’m developing the app via shadow-cljs which is serving the app locally via devtools server. I’m creating a form in re-frame which will capture login details and send to AWS cognito via Ajax (this is where it will need cors permissions). Once logged in, it has access to AWS Lambda resources via api gateway again via Ajax which requires cors. The server provided by shadow-cljs needs to give my browser permission to access AWS resources cross origin.


no it doesn't?


the server answering the AJAX request has to set CORS headers


the server serving the initial page is not involved in that?


Hmm, u think I’m barking up the wrong tree then. Will see what I can get working


from what I understand of what you are trying to do yes


Unused extern imports like

(ns  (:require ["@material-ui/core/AppBar" :as mui-AppBar]))
(def app-bar (factory-apply mui-AppBar)) ;; app-bar isn't used
Will be included in final bundle?


I listened to the ClojureScript podcast episode about npm interop, @thheller . Got curious about the Closure compiler's advanced compilation... Do you know if it makes any attempt to make the generated code more suited for gzipping?


what is gripping?


still no clue what that would mean in that context


Damn autocorrect. Gzipping.


yes, it is optimizing for that


IIRC there was an article about that on the closure tools blog


but can't remember exactly where


but the gist is that closure tries to minimize the number of properties it generates on classes and such. and rename them in a way that has as much re-use as possible


ie. all locals and function args args are renamed after the same pattern (eg. a,b,c,d,...)


but I think webpack does that too nowadays


but some of the more advanced patterns don't work too well in CLJS since we don't type-hint our code


and some of those things require fully typed code


Thanks! Some of the gzip optimizations require fully typed code? I'll go read that blog. I had a specific idea I was wondering about.


some of the optimizations require typed code. some of those are relevant to gzipping since it can pick better names


property ambiguation or whatever that is called

👍 4

I'm new to shadow-cljs and enjoying it a lot so far. Thanks for the good work @thheller! I'm trying to use in throwing together a prototype and wondering if there's something special I should do to get that library to load. Right now it seems the $(...).modal() fn it's supposed to add to jQuery isn't available. Maybe just require it somewhere to make sure the module loads?


All I had to do was

(:require ["jquery-modal"])
and everything worked.

👍 8