Fork me on GitHub
#shadow-cljs
<
2020-06-26
>
Casey06:06:49

I have a customized shadow.build.targets target namespace I'm using, currently it just sits in my codebase along with my app. Is there a way I can pull it out of the source tree, but still have it found on the classpath when shadow runs?

thheller07:06:01

@ramblurr just turn it into a library and use it as a regular dependency

👍 3
Casey07:06:59

good idea, thanks.

pmooser09:06:58

I'm trying to use react-markdown in reagent via shadow-cljs, but I get this error when I require it:

[:app] Build failure:
The required JS dependency "path" is not available, it was required by "node_modules/vfile/core.js".

pmooser09:06:04

What's typically done to fix something like that?

pmooser09:06:26

I guess path is a node.js thing ...

pmooser09:06:44

I can always go for a different approach WRT markdown.

pmooser09:06:10

I found a path-browserify polyfill, but I got a different error, which lead me to this :

pmooser09:06:49

I'm launching via deps ...

pmooser09:06:41

Ok, I think I've worked it out.

pmooser09:06:53

It looks like npm installing path-browserify and process is enough to resolve those issues.

thheller10:06:44

@pmooser npm install -D shadow-cljs in your project

thheller10:06:06

that will bring in those deps ...

kenny15:06:18

I'm trying to output source maps for https://sentry.io/. Setting these keys in the :compiler-options will output a source map file.

:source-map                         true
:source-map-include-sources-content true
:source-map-detail-level            :all
After adding those keys, however, if I visit my production built app, I receive this warning in the console: "DevTools failed to load SourceMap: Could not parse content for http://localhost:3002/js/main.js.map: Unexpected token < in JSON at position 0". It's clearly trying to load sources maps and getting HTML back, thus the error. My question is if there is a way to output source maps and not have the console attempt to load the source maps. I'm guessing when those above keys are set, the outputted JS has some sort of indicator to tell the browser to attempt to load source maps. In a production build without the above keys set, I do not get the warning message printed in the console.

kenny15:06:14

Yes - shadow is including

//# sourceMappingURL=main.js.map
As the last line in the outputted JS. Is there a way to output source maps without this line included in the final JS?

kenny15:06:06

I suppose I can do this sed -i '/sourceMappingURL/d' out/public/js/main.js . Seems like there should be a way to tell shadow to output source maps without the line in the released JS file though.

erik17:06:53

when developing a chrome extension (one with a bg script, content script as well as devtools panel), in what context does the REPL execute and how to access any of bg, content script or devtools panel?

thheller17:06:30

@eallik since they are 3 different contexts you have 3 different runtimes that you can REPL into

thheller17:06:43

unfortunately no editor has good support for switching between them

thheller17:06:53

granted that the API for this in shadow isn't much better

donyorm21:06:25

So I'm trying to run tests with a test build target (using :browser-test as the target), but when I run shadow-cljs watch test no http server is started. Is my config messed up?

{:target :browser-test
   :test-dir "public/js/test"
   :devtools  {:http-port          8021
               :http-root          "public/js/test"
               :http-handler shadow.http.push-state/handle
               }}