This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-23
Channels
- # announcements (2)
- # beginners (150)
- # calva (59)
- # cider (10)
- # clj-kondo (63)
- # cljs-dev (15)
- # cljsrn (34)
- # clojure (127)
- # clojure-dev (16)
- # clojure-europe (12)
- # clojure-italy (18)
- # clojure-nl (6)
- # clojure-russia (3)
- # clojure-uk (23)
- # clojurescript (18)
- # clojutre (15)
- # clr (2)
- # cursive (3)
- # datomic (26)
- # duct (6)
- # fulcro (9)
- # graalvm (3)
- # joker (9)
- # lambdaisland (1)
- # off-topic (12)
- # om (1)
- # pathom (29)
- # re-frame (16)
- # reagent (2)
- # shadow-cljs (57)
- # slack-help (2)
- # spacemacs (45)
- # sql (20)
- # xtdb (3)
- # yada (3)
I need a specific Babel preset that I have set in a local .babelrc
file within a module's folder. I don't want Babel's default transformation of ES6 module syntax to commonjs, so have set it to false (https://babeljs.io/docs/en/6.26.3/babel-preset-env#modules). This doesn't seem to be working. Does shadow-cljs do any other transformation that would effect this?
@studio can you clarify what you are trying to do? "withing a module's folder" can mean many different things? is it in node_modules?
I have decided to persevere with getting Storybook running - after researching it further, the issue is that Storybook is expecting ES Modules and Babel by default is using commonjs so there is a conflict. I have a custom babel config file (https://storybook.js.org/docs/configurations/custom-babel-config/#docs-content) but it doesn't seem to be getting picked up as there are still errors surrounding the use of default
shadow-cljs does not produce ES Modules. no matter how you configure it, babel isn't even involved in that part
can you setup a sample project for this? maybe I can help if you show me some actual code
It loads Storybook fine - if you change a string, like the buttons text, then it reloads and errors with can't redefine non-configurable property "default"
. It also loads "Default" as a story, which is wrong, there should only be one story which is "Normal".
Everything seems to work, unless you change the name of the function:
(defn ^:export normal [button] "Hello")
(defn ^:export normalXXX [button] "Hello")
this._data[id] is undefined
Do you get that too? Changing anything else, the reload works as expected.
Just a tip: there are some clojurescript libs similar to storybook that could be worth checking out. https://github.com/bhauman/devcards https://github.com/nubank/workspaces
What does [:no-worker :app]
mean when attempting to start a CLJS REPL for the build :app
?
Is there some workaround for the dynamic import problem? https://github.com/thheller/shadow-cljs/issues/486
Ok, thanks. Is this related or is it another kind of problem?
SHADOW import error /home/project/.shadow-cljs/builds/test/dev/out/cljs-runtime/shadow.js.shim.module$react_native.js
/home/project/node_modules/react-native/Libraries/Utilities/warnOnce.js:15
const warnedKeys: {[string]: boolean} = {};
^^^^^^^^^^
SyntaxError: Missing initializer in const declaration
at new Script (vm.js:80:7)
at createScript (vm.js:274:10)
at Object.runInThisContext (vm.js:326:10)
at Module._compile (internal/modules/cjs/loader.js:664:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
That would explain it, thanks. I wasn't aware that I could not import react-native without metro.
I guess that this makes a lot more complicated testing react-native apps using shadow-cljs.
dunno. how are they usually tested? shouldn't be much more complicated than those setups
I'm not sure either, I'm coming from the cljs side. For the look of what I read it involves lots of babel.