This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-02
Channels
- # announcements (21)
- # bangalore-clj (1)
- # beginners (122)
- # calva (29)
- # cider (9)
- # cljdoc (1)
- # cljs-dev (7)
- # cljsrn (1)
- # clojure (84)
- # clojure-dev (11)
- # clojure-europe (2)
- # clojure-houston (2)
- # clojure-italy (31)
- # clojure-nl (5)
- # clojure-uk (37)
- # clojuredesign-podcast (3)
- # clojurescript (14)
- # cursive (66)
- # data-science (5)
- # datavis (1)
- # datomic (6)
- # fulcro (16)
- # graphql (4)
- # jobs (2)
- # music (1)
- # off-topic (20)
- # pedestal (1)
- # re-frame (2)
- # reagent (2)
- # shadow-cljs (155)
- # spacemacs (5)
- # tools-deps (5)
- # vim (8)
- # yada (1)
hey! I can see that shadow
puts the nrepl port into a file called .shadow-cljs/nrepl.port
- is there anyway to get cursive to pick this up automatically?
https://github.com/dazld/frontend-playground < I’ve put together some boilerplate and wanted to update the readme
Is there a guide to integrate Dirac to shadow-cljs?
I guess, we will need something like this: https://github.com/binaryage/dirac/blob/master/examples/figwheel-main/src/repl/dirac_figmain/repl.clj, run shadow-cljs nREPL server, start there Dirac Agent and teach dirac middleware to understand shadow-cljs internals
i'm attempting to use react-bootstrap
with shadow-cljs
and i'm seeing a weird behaviour. loading the compiled js in the browser throws an exception [1] only on the first load and nothing is rendered, and then any subsequent hot-reload renders the button just fine. can anyone seem what i'm doing wrong? 🙂
(ns myproject.views
(:require
[reagent.core :as r]
["react-bootstrap" :refer [Button]]))
(defn home-panel []
(fn []
[(r/adapt-react-class Button) {:variant "primary"} "Test 1"]))
[1]
Uncaught TypeError: (0 , _uncontrollable.default) is not a function
at Object.shadow$provide.module$node_modules$react_overlays$Dropdown (Dropdown.js:306)
at shadow.js.jsRequire (js.js:63)
at Object.shadow$provide.module$node_modules$react_bootstrap$Dropdown (Dropdown.js:19)
at shadow.js.jsRequire (js.js:63)
at Object.shadow$provide.module$node_modules$react_bootstrap$index (index.js:84)
at Object.shadow.js.jsRequire (js.js:63)
at Object.shadow.js.require (js.js:97)
at myproject.views.js:6
looking at the node_modules/react-bootstrap/node_modules/package.json
i do see some potential conflicts, mainly react
and react-dom
which i have in my own root package.json
. how might i go about resolving dependency conflicts? in figwheel land i would use a combination of :exclude
s and top level dependencies.
ah sorry, long day at work. there is no node_modules
directory in node_modules/react-bootstrap
.
when npm installs a package with a dependency conflict it installs conflicts in a nested node_modules
directory
(0 , _uncontrollable.default)
this looks very suspiciuous though so might be something else
react-overlays
has the nested install (so node_modules/react-overlays/node_modules/uncontrollable/...
)
ah, gotcha! thanks for digging into it. i'm only just reacquainting myself with npm after spending a long time (happily) avoiding it.
Referring to this chapter from the documentation (https://shadow-cljs.github.io/docs/UsersGuide.html#_requiring_js), I am trying to mix javascript and clojurescript. I converted my JSX files with Babel, however the following line import React, { Component } from 'react';
leads me to the error Requested module does not have an export "Component".
when I import the file. Does anyone have an idea how to solve this issue?
they just currently have this compatibility mode that still allows this, just won't in the future
ok! Thanks a lot!
@joshkh not sure that can actually be resolved. in webpack it'll happily use 2 versions of the same library but that isn't supported in shadow-cljs because I think that is nonsense
@thheller Are there anyway to get something else than the default export?
In the example you provided me for importing react
is there a way to get React
is the default export
I understand, I am trying to explain my problem with the example of react
and apply it to other libraries
react
itself is packaged as commonjs, shadow-cljs and closure-compiler only support strict-style commonjs -> ESM interop (as will webpack5)
guess, I will have to study JS(hit) a bit
it depends on how the package is packaged. if is it actual ESM code or commonjs (ie. compiled by babel)
the situation is a bit icky currently as many packages are switching from the compatible style to the strict style
Sorry for the newbee questions xD
I am trying to improt this type of dependencies
the webpack folks have been talking about this for a while now https://www.youtube.com/watch?v=p-MhcctQBlY
Thanks, I am totally new to JS, I started UI on the web with shadow-cljs, so have been totally protected from all that. xD
might actually be smoother in webpack for now given that it still supports the old stuff
Yes, I accept a bit of impurity (Clojure is meant to be practical xD)
I hope you are not trying to put react-chart-editor on the classpath and import directly?
I would like to use this statement in a custom jsx file import PanelMenuWrapper from 'react-chart-editor';
nope, I am trying to build custom js file, export them through babel
nope, because PanelMenuWrapper
becomes the default exort
and the default export is not one that embeeds all of them
PlotlyEditor
is the default export
thanks for the precision! The issue is the default export is a (extremely restricted) subset of the exposed variable in the index.js
file
import PlotlyEditor from './PlotlyEditor';
import DefaultEditor from './DefaultEditor';
import EditorControls from './EditorControls';
import {EDITOR_ACTIONS} from './lib/constants';
export {DefaultEditor, EditorControls, EDITOR_ACTIONS};
export * from './lib';
export * from './components';
export * from './default_panels';
export default PlotlyEditor;
haha, the best advice ever xD
ohhhh this seems cool
the funny stuff is
the cljs version works, I get full access to everything.
but not the jsx
nope, still gives me PlotlyEditor
Althgough Babel translate it to
const RCE = require('/node_modules/react-chart-editor/lib/index.js');
the shadow-cljs part works totaly fine
The workflow is: custom JSX -> babel -> cljs
I am editing the custom JSX file
nope 🙂
const RCE = require('react-chart-editor');
is the output babel
shadow-cljs is great 🙂
nope, when I enter console.log(RCE.Button);
I get undefined
funnily enough on shadow-cljs I get something xD
yes shadow-cljs have either. This is what kills me xD. I can write better js in cljs than in js
so if you console.log(RCE)
in the JS you get different output then (:require ["react-chart-editor" :as x])
and (js/console.log x)
?
nope.
JS -> undefined
, cljs -> {default f}
and when you open it you get the whole shebang of objects.
I get f PlotlyEditor(props)
for js, against the expected {default: f, ...}
definitively require
I copy past your code
let me try again
with a minimal example
ok, with minimal example, it still output the default export from index.js
const RCE = require('react-chart-editor');
console.log(RCE.PanelMenuWrapper);
console.log(require('react-chart-editor'));
const CustomEditor = function (props, context) {
return React.createElement("div", null);
};
export default CustomEditor;
got undefined
, and PlotlyEditor
as output in the browser
ƒ PlotlyEditor(props)
you remember when I asked you how to load npm packages in the browser and you said to me to use the "eval" option somehwere in the config?
this was because of that XD
I wish. 🙂 My rationale was that it would require me a lot of work to rewrite the stuff in re-frame
.
They have a two way communication between the editor and plot, and plotly have a gigantic amount of options.
(obviously I could start small), but I doubt my employer would accept me saying: I can't use JS, so I reimplemented the wheel xD
but if it does not work, I will just go with the slow way, it is just annoying. I tried to reimplent some part directly in CLJS, but the I don't understand how they bind this
in their subcomponent.
Well thanks, I need to go to sleep but it was really nice and enjoyable to talk to you @thheller
Reinventing the wheel
Works all the time