This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-03
Channels
- # adventofcode (198)
- # aleph (10)
- # announcements (7)
- # aws (17)
- # beginners (353)
- # boot (1)
- # calva (13)
- # cider (18)
- # cljdoc (2)
- # cljs-dev (11)
- # cljsrn (1)
- # clojure (87)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-greece (13)
- # clojure-italy (18)
- # clojure-kc (2)
- # clojure-nl (9)
- # clojure-quebec (1)
- # clojure-russia (1)
- # clojure-spec (55)
- # clojure-uk (114)
- # clojurescript (18)
- # clojurex (14)
- # code-reviews (5)
- # core-async (17)
- # cursive (23)
- # data-science (1)
- # datomic (82)
- # docker (8)
- # duct (10)
- # emacs (8)
- # figwheel (3)
- # figwheel-main (5)
- # fulcro (13)
- # hyperfiddle (8)
- # jobs (1)
- # midje (1)
- # mount (1)
- # nrepl (2)
- # off-topic (72)
- # om (2)
- # pathom (10)
- # portkey (2)
- # re-frame (9)
- # reagent (3)
- # reitit (9)
- # ring-swagger (14)
- # schema (1)
- # shadow-cljs (91)
- # spacemacs (21)
- # sql (6)
- # tools-deps (19)
- # unrepl (9)
- # vim (41)
When I starting using re-frame in my project, the release
build of my browser npm module started erroring with Cannot read property 'navigator' of undefined
during import of the module. I've tracked down that goog.base.js
sets $
at the end, but window.global
is undefined.
I'm not sure if it's something shadow-cljs is doing, or something webpack is doing, or both. Any ideas how to proceed?
@mel.collins which version are you on? I fixed a related issue recently
hah, I could've sworn I updated shadow-cljs last week, but apparently I was still on 2.6.10. The lastest version does indeed Just Work™, thanks!
Is there a way to bundle all dependencies with a :node-library
or :npm-module
as is done with :web-worker true
?
not sure how :web-worker
is relevant to the bundling but all dependencies for node is not possible
Gotcha, thank you.
FWIW there is an open issue about that https://github.com/thheller/shadow-cljs/issues/290
just didn't have time to work on it. also not totally convinced that it should be done.
i used shadow-cljs yesterday to bundle cljs pretty-printer into a node.js project
(i couldn’t figure out how to produce a commonjs module file from native cljs compiler)
love it, it just worked
i wanted to prevent confusion by prepending an // Auto-generated
comment to the output file: https://github.com/shaunlebron/highlight-tree-sitter/blob/master/shadow-cljs.edn#L6
is that possible?
i suppose a umd target would also work for my use-case
oh, umd isn’t a separate target
open a ticket about the prepend stuff. I'm barely at the PC currently and didn't get much done the past few weeks
np, great work on all this
@jiyinyiyong love the website!
OT, but, what is cljs pretty printer, @shaunlebron?
cljs.pprint
just wanted to print js arrays as s-expressions
That's cool. Will you try get that into Atom to replace the current regex based tokenizer?
tree-sitter is actually built for atom
it’s available for some langs, js included. clojure is being worked on
Hi,
I'm building my cljs to js for https://storybook.js.org in accordance with https://github.com/shadow-cljs/examples/blob/master/cljs-storybook/shadow-cljs.edn . I'd like to be able to see my sourcemaps, but the URLs are something like //# sourceMappingURL=cljs.core.async.impl.buffers.js.map
, which is not where they're actually served from. Accd to the user guide, :source-map-path
doesn't have any effect at all - is there a solution to this? Thanks very much!
@hoopes the problem is not with shadow-cljs. the problem is that the code is processed further by storybook (webpack I believe). it must read the source maps and apply them to its output
@hoopes I think it needs this but not sure https://github.com/webpack-contrib/source-map-loader
cool, i was just looking through storybook stuff to figure out how to hook into their webpack config
Hi!
I'm running into some differences on the runtime behavior of require
between :npm-module
and :browser-test
targets.
Given the sample import ["module/folder/file-with-default-function.js" :as file :default function]
, here's what the names get assigned to:
| | :browser-test | :npm-module |
|----------+----------------------------------------+-----------------------|
| file | Object{default: function(args){ ... }} | function(args){ ... } |
| function | function(args){ ... } | undefined |
Is that expected?
The current workaround is a shim cljs file that checks for the existence of a default and binds the var to that instead@aisamu when using :npm-module
it emits a straight up require("module/folder/file-with-default-function.js")
call. however that is filled in I cannot control
If :js-options
is located at the root of the build config (next to :target
), then the result is the same 😕
hmm how is webpack configured? they have a setting for this. maybe you are not using the "new" default behavior?
It's a rather large existing webpack 3.11.0
project. Is there something specific I should look for?
the result in :browser-test
looks correct to me. not sure about webpack and :npm-module
Should I care about this warnings?
------ WARNING #2 --------------------------------------------------------------
File: com/cognitect/transit/impl/writer.js:256:8
variable isObject is undeclared
--------------------------------------------------------------------------------
------ WARNING #3 --------------------------------------------------------------
File: fulcro_css/css_implementation.cljc:212:56
variable garden is undeclared
--------------------------------------------------------------------------------
@vigilancetech btw the issue you reported the other day was related to this https://github.com/nathanmarz/specter/commit/e7abb2b5384b0b64d871fb347be7c34a15473eb2
yes, seems to do the trick. Thanks!
okay, now does anyone see a problem with this?
shadow-cljs - config: /home/kevin/0work/guardian-dashboard/shadow-cljs.edn cli version: 2.7.6 node: v8.12.0
shadow-cljs - starting ...
Dec 03, 2018 2:28:19 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Dec 03, 2018 2:28:19 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
shadow-cljs - HTTP server for :client available at
shadow-cljs - server version: 2.7.6
shadow-cljs - server running at
shadow-cljs - socket REPL running on port 42319
shadow-cljs - nREPL server started on port 45695
and
Starting Nmap 7.70 ( ) at 2018-12-03 14:38 PST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00016s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 998 closed ports
PORT STATE SERVICE
631/tcp open ipp
8080/tcp open http-proxy
Nmap done: 1 IP address (1 host up) scanned in 0.65 seconds
(the latter was done with the -Pn
flag)
And cider won't connect with merely the "failed" error (nothing else, and doesn't get to the point where it even creates the nrepl message buffer even tho its enabled).well, shouldn't there be a port open for the nrepl server for instance?
I think it does all the ports rather than just the common ones