This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-11
Channels
- # announcements (6)
- # babashka (35)
- # beginners (6)
- # biff (2)
- # calva (1)
- # cider (16)
- # clj-kondo (14)
- # clojure (176)
- # clojure-austin (13)
- # clojure-europe (7)
- # clojure-norway (6)
- # clojure-uk (12)
- # clojurescript (4)
- # cursive (11)
- # data-science (3)
- # datalog (10)
- # datomic (45)
- # events (1)
- # fulcro (2)
- # hyperfiddle (29)
- # leiningen (14)
- # lsp (2)
- # meander (2)
- # off-topic (24)
- # polylith (5)
- # re-frame (2)
- # shadow-cljs (21)
- # specter (14)
- # tools-deps (16)
- # xtdb (5)
Is it possible to shim CLJS namespaces with goog.exportSymbol
? I have a library that works with refx.alpha
despite the fact the library uses re-frame.core
please ask that question again without the goog.exportSymbol
part. what do you want to achieve? redirect all calls from re-frame.core
to refx.alpha
?
goog.exportSymbol
is about exporting, i.e. preserving after :advanced
. it is very unlikely to be useful for anything you want to do
there is :build-options {:ns-aliases {re-frame.core refx.alpha}}
, basically replaces every require and use of re-frame.core
with refx.alpha
How do I translate the following js into clojurescript with shadow?
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
There’s a bunch of examples given here https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
I would guess (require '["three/addons/controls/OrbitControls" :refer [OrbitControls])
, assuming the package does not use exports
in its package.json (otherwise you will need to look at its exports and see what the “proper” path is)
That is what I expected to work. It turned out that three docs are incorrect: The correct import is: [“three/examples/jsm/controls/OrbitControls” :refer [OrbitControls]] https://stackoverflow.com/a/76267637/7483073
Here I am with another obscure use case. I'm trying to load Shadow-compiled CLJS code into a not-so-friendly environment: a legacy JS application which probably has polluted the global namespace. Esp. by using require.js. The error I'm seeing is:
base.js?cache=bust:1279 TypeError: global.__exportStar is not a function
at shadow$provide.module$node_modules$$sentry$utils$dist$index (index.js:4:9)
at shadow.js.jsRequire (js.js:66:18)
at shadow$provide.module$node_modules$$sentry$hub$dist$scope (scope.js:4:15)
at shadow.js.jsRequire (js.js:66:18)
at shadow$provide.module$node_modules$$sentry$hub$dist$index (index.js:3:15)
at shadow.js.jsRequire (js.js:66:18)
at shadow$provide.module$node_modules$$sentry$minimal$dist$index (index.js:4:13)
at shadow.js.jsRequire (js.js:66:18)
at shadow$provide.module$node_modules$$sentry$core$dist$index (index.js:3:17)
at shadow.js.jsRequire (js.js:66:18)
where the index.js is something like that:
shadow$provide["module$node_modules$$sentry$utils$dist$index"] = function(global,require,module,exports) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./async"), exports);
no clue. this all looks like it should. what is the tslib related code in particular? seems like that is the source of the problem? maybe its a version conflict? some old/new incompatible tslib with a function missing?
I'd suspect that this is just a version conflict, using an incompatible version. i.e. not the tslib version sentry expects
But I’m curious as to why this manifests in this legacy environment and not the standalone one. Perhaps since we use sentry also there there could be a conflict, as you say.
Turns out that we don't use sentry in development, so if it's a tslib incompatibility, it's something else causing it.
I managed to load our base module if I set window.define
to undefined (which is a require.js thing). However, loading an additional module doesn't work - I think require.js mangles things too much. Moving the code loading before require.js kicks in works but is more invasive.
Another error is:
base.js?cache=bust:1279 TypeError: tslib.__assign is not a function
at shadow$provide.module$node_modules$downshift$dist$downshift_cjs (downshift.cjs.js:2347:43)
with the line in question being:
var defaultProps$2 = tslib.__assign(tslib.__assign({}, defaultProps$3), { getA11yStatusMessage: getA11yStatusMessage });