This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-13
Channels
- # announcements (1)
- # babashka (30)
- # beginners (43)
- # biff (24)
- # calva (72)
- # cider (12)
- # clj-commons (24)
- # clj-on-windows (10)
- # cljsrn (23)
- # clojure (123)
- # clojure-bay-area (6)
- # clojure-europe (43)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-uk (9)
- # clojurescript (125)
- # core-async (9)
- # cursive (2)
- # data-science (3)
- # datomic (30)
- # devops (1)
- # emacs (13)
- # events (5)
- # fulcro (15)
- # graalvm (3)
- # gratitude (1)
- # humbleui (11)
- # lsp (5)
- # nbb (24)
- # off-topic (11)
- # pedestal (5)
- # releases (1)
- # remote-jobs (1)
- # sci (15)
- # scittle (16)
- # shadow-cljs (15)
- # sql (11)
- # tools-deps (9)
- # xtdb (5)
Does anyone have experience passing Clojurescript source maps through the Metro bundler and getting the full results back out? Is this even possible?
Something related hit my inbox the other day. While I doubt it's an easy fix it might help you on your way: https://github.com/facebook/metro/issues/104#issuecomment-1278243145
@U055DUUFS Awesome, thanks for that pointer. Subscribing to that thread, and when the feature is straightened out with metro I’ll document whatever extra CLJS needs.
For reference, I can create an advanced compilation single JS file of my Krell app, and feed that into the Metro bundler, and deploy it successfully. And I can create source maps from my CLJS, and I can create source maps from Metro. But the final source maps I get from Metro reference the advanced-compiled index.js
that the CLJS compiler created, not the original CLJS source it came from.
Can I ask you about your setup?
I was able to write a node.js script that merges cljs source maps into metro’s source map file. Maybe you can try it? https://github.com/shaunlebron/cljs-expo/blob/659505a1f832816f142f111178911294156755f2/expo/remap.js
I haven’t figured out how to insert this into Metro as a PR
and actually I just found this method: http://austinbirch.co.uk/clojurescript-react-native-bundling-release.html
@shaunlebron Oh, interesting, let me try this out.
This script, modified a little bit for my different source file locations, turns out to have worked to get me ClojureScript-aware source maps. Thanks @shaunlebron!
did you use my script or austin’s?
(With modifications for my paths etc)
Great! Do you have any success for dev source maps? Just use chrome dev tools?
I haven’t tried for dev yet, I just use the errors I get in the Krell repl.
the Krell repl catches runtime errors?
(we’re using Expo)
Yes, it does.
Just a heads-up. I’m having some trouble using this method in a Hermes-bytecode build from Expo, internally produced with Metro somehow. This is the source map file e.g.:
{
"version": 3,
"sources": [],
"names": [],
"mappings": "A,4B,M,...",
"x_facebook_sources": [],
"x_hermes_function_offsets": {
"0": [
0,
74130,
74394,
74423,
74512,
...
]
}
}
Hm, I haven’t tried with Hermes yet, interesting that it seems like it’s got some Hermes-specific info in there.
Even turning Hermes off, our "mappings" key is empty, and they seemed to be moved to the x_facebook_sources
extension:
{
"version": 3,
// STANDARD
"sources": [ ... lots of filenames ... ],
"sourcesContent": [ .. lots of file sources ... ],
"names": [], // <-- EMPTY
"mappings": "" // <-- EMPTY
// EXTENSIONS
"x_facebook_sources": [
null,
[
{
"names": [ ... lots of names ],
"mappings": "AAA;wBCyB,QD;..."
}
],
[
{
"names": [ ... lots of names ...],
"mappings": "AAA;iBCiB;ECwB;..."
}
],
... lots more ...
],
}
This script, modified a little bit for my different source file locations, turns out to have worked to get me ClojureScript-aware source maps. Thanks @shaunlebron!