does :target :esm support source maps? I'm not seeing any in the output dir during dev
I have a repro for the source maps here if you're interested.
cd /tmp
git clone git@github.com:babashka/nbb.git nbb2
cd nbb2
clj -M -m shadow.cljs.devtools.cli --force-spawn watch modules --config-merge '{:compiler-options {:source-map true}}'
in another tab:
cd /tmp/nbb2
ls lib
No source maps...If I understand you correctly, the source-map true thing isn't even necessary since it should be the default behavior in watch?
right, ok so misunderstanding I guess. in dev mode the source maps are in the cljs-runtime folder
since all the "modules" are just basically a group of imports
aaaah ok!
--> cat nbb_transit.js
import "./nbb_core.js";
import "./cljs-runtime/shadow.module.nbb_transit.prepend.js";
SHADOW_ENV.setLoaded("shadow.module.nbb_transit.prepend.js");
import "./cljs-runtime/com.cognitect.transit.util.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.util.js");
import "./cljs-runtime/com.cognitect.transit.delimiters.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.delimiters.js");
import "./cljs-runtime/com.cognitect.transit.caching.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.caching.js");
import "./cljs-runtime/com.cognitect.transit.eq.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.eq.js");
import "./cljs-runtime/com.cognitect.transit.types.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.types.js");
import "./cljs-runtime/com.cognitect.transit.impl.decoder.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.impl.decoder.js");
import "./cljs-runtime/com.cognitect.transit.impl.reader.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.impl.reader.js");
import "./cljs-runtime/com.cognitect.transit.handlers.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.handlers.js");
import "./cljs-runtime/com.cognitect.transit.impl.writer.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.impl.writer.js");
import "./cljs-runtime/com.cognitect.transit.js";
SHADOW_ENV.setLoaded("com.cognitect.transit.js");
import "./cljs-runtime/cognitect.transit.js";
SHADOW_ENV.setLoaded("cognitect.transit.js");
import "./cljs-runtime/nbb.impl.transit.js";
SHADOW_ENV.setLoaded("nbb.impl.transit.js");
import "./cljs-runtime/shadow.module.nbb_transit.append.js";
SHADOW_ENV.setLoaded("shadow.module.nbb_transit.append.js");
try { nbb.impl.transit.init(); } catch (e) { console.error("An error occurred when calling (nbb.impl.transit/init)"); console.error(e); }don't really have anything this would source map to 😉
but the other files will have source maps
and yes, the config-merge does nothing (since its true by default)
yeah the transit thing is a completely different thing. I was trying to upgrade shadow to see if I would get source maps. but this mystery is now solved, thanks
still the chrome inspector/profiler doesn't seem to use them somehow
always works fine to me? maybe whatever webserver you use doesn't serve .map files?
I mean, I'm profiling node code
ah right node may require loading the source-map-support module
the node targets do that automatically but :esm does not
ok, so I manually load this in my code?
node -r source-map-support/register your-file.js
after npm install source-map-support of course
no clue if that works with the chrome inspector though. never looked into that
I was running this:
node --enable-source-maps --inspect-brk cli.js -e "(require '[honey.sql])"node always had a funny relationship with source maps
first time I'm trying this stuff
didn't even know node had a --enable-source-maps option? maybe my info is outdated?
I've tried both now:
node --enable-source-maps --inspect-brk -r source-map-support/register cli.js -e "(require '[honey.sql])"
Don't see any .cljs references in the profiler, just .jsyeah sorry, can't help here. I don't use node much, so no clue what it takes to make this work
all the files do have the correct //# sourceMappingURL=cognitect.transit.js.map type comments and the files do exist, so 🤷
no problem, it's fine
I mean I don't detect any obvious places where I can optimize anyway
thanks for the help!
of course? should be created by default just as all the other targets?
ok not seeing any but don't have time to debug right now, will try again tomorrow. thanks for the reply
when I want to upgrade to the newest shadow I should go through some other hoops
[:modules] Build failure:
Module Entry "cognitect.transit" was moved out of module ":nbb_transit".
It was moved to ":nbb_core" and used by #{:nbb_transit :nbb_core}.haven't touched that code for like 10 years, so that is not "new"
I suspect shadow's dev code now depends on transit, could that be new?
as the error says. some code in :nbb_core (all the namespaces that includes) wants to use transit, but can't because it wants to be its own module
hmm good question
coming from 2.28.18 -> 3.1.8
hmm well it has. but for like 5 years or something. definitely longer than 2.28.18
this error is new for me though :)
only happens when upgrading shadow
so, long time
so only happens in dev? release is fine?
so since 2.10.0 - 2020-06-04