This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-08
Channels
- # aleph (5)
- # announcements (3)
- # aws-lambda (24)
- # babashka (17)
- # beginners (59)
- # calva (168)
- # clerk (4)
- # clj-kondo (62)
- # clojure (77)
- # clojure-belgium (4)
- # clojure-brasil (10)
- # clojure-ecuador (3)
- # clojure-europe (41)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-norway (24)
- # clojure-uk (2)
- # clojurescript (44)
- # clr (21)
- # community-development (7)
- # conjure (1)
- # cursive (6)
- # datalevin (15)
- # datomic (1)
- # deps-new (12)
- # emacs (45)
- # events (1)
- # fulcro (8)
- # funcool (7)
- # graphql (5)
- # hugsql (15)
- # jobs (2)
- # matcher-combinators (17)
- # meander (14)
- # membrane (31)
- # pathom (28)
- # pedestal (8)
- # practicalli (6)
- # re-frame (12)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (32)
- # tools-deps (8)
- # vim (16)
Is there a way to make changes in environment variables invalidate shadow-cljs cache? At the moment I am resorting to adding a namespace to my :cache-blockers
, but I’m wondering if there is a more elegant way to handle this.
In short, my configuration has a few :closure-defines
like so
:closure-defines
{foo.bar/const #shadow/env ["FOO_BAR" "BAZ"]}
I’ve noticed that running npx shadow-cljs release target
once then running FOO_BAR=QUUX npx shadow-cljs release target
will give me a bundle with the older environment variable set, unless I delete cache in between builds.
Maybe finding a way to set :cache-level
to :off
in release builds is what I want?There wasn’t a server running beforehand, but invalidating caches would ensure changes would be reflected in the compiled bundle.
The problem appeared when I would run npx shadow-cljs compile target
multiple times, yet I didn’t see :closure-defines
update in the app. Then out of sheer luck I tried a release build and everything worked; then I suspected my compilation caches were messing with things
env variables are used from the started server, so if you don't restart that they are not picked up
@thheller another ESM related issue: when I
1) use :js-provider :import
and
2) have a classpath ESM that makes uses of a npm ESM pkg (`promsemirror-state` in the repro below)
then advanced compilation would fail with Required namespace "esm_import$prosemirror_state" never defined.
Repro is here https://github.com/lins05/my-repros/tree/master/repro-shadow-cljs-advanced-using-npm-esm
Thx! To be accurate, npm-module is only warning, but this completely fails the release build
I want to be able to build several versions of my app, each with different :closure-defines
values. At the moment I am duplicating everything for each build, so
:builds {:env1 {:target :browser
:compiler-options {:output-feature-set :es-next
:closure-defines {app.foo/BAR "baz1"}}
:modules {:main {:init-fn app.core/init}}
:output-dir "public/js"
:asset-path "/js"
:dev {:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}}
:devtools {:http-root "public"
:http-port 3900
:preloads [devtools.preload
shadow.remote.runtime.cljs.browser]}}
:env2 {:target :browser
:compiler-options {:output-feature-set :es-next
:closure-defines {app.foo/BAR "baz2"}}
:modules {:main {:init-fn app.core/init}}
...
Is there a way to share things between these different builds? or maybe a better way to inject variables for different builds?There is --config-merge
to use from the command line https://shadow-cljs.github.io/docs/UsersGuide.html#config-merge
(edit: wrong link)
Or defaults: https://shadow-cljs.github.io/docs/UsersGuide.html#build-target-defaults
ah we do use mocha-latte for writing tests https://github.com/contentjon/mocha-latte
we only do e2e testing. for component tests, we use react-testing-library. again just with helper functions and interop
so I assume its done via :npm-module
build and running through the built-in webpack?
the way we do it is a bit strange, I didn't set it up, but it works. we write the CLJS output to a dir in node_modules, and then we have a JS file for each test ns that requires it.
e.g. we have a namespace amperity.cypress.integration.databases
and then a cypress/integration/databases.spec.js
which contains a require
require("amperity-cypress/amperity.cypress.integration.databases");
and cypress watches that dir and rebuilds when the node_module/amperity-cypress
code changes