Is there a way to alias a namespace per build? So two builds would use the same namespace in the code, but when built are replaced with aliased namespaces
@mruzekw you can set :build-options {:ns-aliases {my.app.foo my.app.bar}}
. that will make it use .bar
whenever .foo
is required in the build
@jag I can't tell what is going on but the package doesn't seem to be bundle-able. looks like you are supposed to directly include it via a script tag
I mean it even has tons of custom instructions for webpack. doesn't even work out of the box there. https://docs.mathjax.org/en/latest/web/webpack.html
the mathjax
package seems to be targetted for node only
Thanks @thheller. Sorry if this was obvious. My JS knowledge needs a bit of a turbo boost.
not at all obvious. quite the opposite actually.
Hi! I’m having issues making Leaflet work in the build I’m trying to convert. The issue is that some plugin of Leaflet refers to the global L
variable that is traditionally exposed by leaflet. The NPM version of leaflet does not expose the global. In another lein project I fixed this by running webpack, with the following tweak:
new webpack.ProvidePlugin({
// Leaflet markercluster plugin requires global L object.
L: 'leaflet'
}),
Is there some way of solving this naturally in shadow-cljs? Seems like I could change my :js-provider
, but that would kind of remove the point of moving to shadow-cljs.
Maybe create my own cheat where I make a new module that requires leaflet and exposes the global?@ingesol :js-options {:resolve {"leaflet" {:exports-globals ["L"]}}}
in the build config might do the trick. or just (js/goog.exportSymbol "L" L)
with (:require ["leaflet" :as L])
somewhere before the plugin is loaded
@thheller Thanks! Will try
worked nicely with that export-globals
thing. Tried to find it in the docs, seems undocumented for now?
might be yeah. very rare thats actually needed.
Having react-native as a target, when I'm connected to "on device repl" (`(shadow/repl :app)`), I'm having a string encoding issue. when using println in the REPL all non ASCII chars are ?
any idea on how to fix that?
@defa shadow-cljs uses unicode everywhere so this should be fine. did you try shadow-cljs cljs-repl app
directly and check if it happens there too? if so it is your connection to the other REPL
@thheller hi, might be useful for you and others: https://akovantsev.github.io/corpus/shadow-cljs this is aggregated slack log on a single page, rather than spread across hundreds of 1-day=1-page files at https://clojurians-log.clojureverse.org/shadow-cljs/
I must be doing something wrong. I have a simple app build:
{:app
{:target :node-script
:output-to "out/server.js"
:main com.disney.rant-lsp/main
:compiler-options {:infer-externs true}}
:test
{:target :node-test
:output-to "out/node-tests.js"
:compiler-options {:infer-externs false}
;;:ns-regexp "-spec$"
:autorun true}}
I do npx shadow-cljs compile app
. The app runs fine, until I package it (it’s a VS Code extension). The packaging doesn’t include the .shadow-cljs
directory. This used to work, but recently I started getting this:
Error: ENOENT: no such file or directory, open '/Users/wisej041/.vscode/extensions/wdi.rant-1.0.2/server/.shadow-cljs/builds/app/dev/out/cljs-runtime/goog.debug.error.js'
I didn’t think I had to include .shadow-cljs
; is that correct?
@wiseman you need to run shadow-cljs release app
if you want to publish something. compile
and watch
are development builds only meant to run on the machine they were compiled on
@misha yikes that file is gigantic. doesn't seem very practical to me. where did you get the data?
thanks, @thheller!
It is practical, but for staying open in a tab, not for getting open willy-nilly every few minutes :) Data is from scraped second url, clojureverse one
Try doubleclicking words, you’ll see what I mean
The other one is not practical, because it is not 100% indexed by google. I had to download all the files and write a script to find stuff. So for me this one is much better, even if it is a little big.
Nice! Thank you!