This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-21
Channels
- # beginners (55)
- # cider (13)
- # cljdoc (4)
- # cljsjs (1)
- # clojure (11)
- # clojure-spec (7)
- # clojure-uk (9)
- # clojurescript (42)
- # docs (5)
- # figwheel-main (9)
- # fulcro (4)
- # graphql (4)
- # hoplon (27)
- # keechma (32)
- # leiningen (11)
- # luminus (2)
- # nyc (2)
- # off-topic (73)
- # parinfer (1)
- # re-frame (36)
- # reagent (2)
- # reitit (6)
- # ring-swagger (3)
- # shadow-cljs (51)
- # spacemacs (4)
- # tools-deps (17)
- # uncomplicate (1)
has anybody ever seen:
goog.nodeGlobalRequire=function(path){return false};goog.provide("goog.debug.Error");goog.debug.Error=function(opt_msg){if(Error.captureStackTrace)Error.captureStackTrace(this,goog.debug.Error);else{var stack=(new Error).stack;if(stack)this.stack=stack}if(opt_msg)this.message=String(opt_msg);this.reportErrorToServer=true};goog.inherits(goog.debug.Error,Error);goog.debug.Error.prototype.name="CustomError";goog.provide("goog.dom.NodeType");goog.dom.NodeType={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12};goog.provide("goog.string");goog.provide("goog.string.Unicode");goog.define("goog.string.DETECT_DOUBLE_ESCAPING",false);goog.define("goog.string.FORCE_NON_DOM_HTML_UNESCAPING",false);goog.string.Unicode={NBSP:" "};goog.string.startsWith=function(str,prefix){return str.lastIndexOf(prefix,0)==0};goog.string.ends
TypeError: Cannot set property 'Error' of undefined
at /home/arichiardi/git/laputa/continuous-delivery/bin/create-publish-pipeline:69:102
at Object.<anonymous> (/home/arichiardi/git/laputa/continuous-delivery/bin/create-publish-pipeline:3038:3)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
the target is :node-script
@richiardiandrea that might be :whitespace
not being compatible with node
.
@eoliphant it always helps to run a shadow-cljs browser-repl
and then calling (require '["aws-sdk" :as x])
(js/console.dir x)
if the object has a AWS
property you want :refer
. if it has a .default
property you want :default
. if it has no properties at all and is just a function you want :as
I’m testing out shadow.cljs with a seemingly basic implementation of the npm package react-select.
I’m using the code from here, which works fine with cljsjs. https://gist.github.com/pesterhazy/6c517653945f84a39c1ae3cc8b20c552. Shadow however, serves me up this error.
Uncaught Error: Assert failed: Expected React component in: [:> nil {:value nil, :options #js [#js {:value "a", :label "alpha"} #js {:value "b", :label "beta"} #js {:value "c", :label "gamma"}], :onChange #object[Function]}]
Any ideas?js/window.Select
is not defined. Most likely, importing of cljsjs.react-select
creates a global Select
object but shadow-cljs
does not. Instead of js/window.Select
you want to use the stuff that you explicitly import.
Also, I always thought that such things must be wrapped in reagent.core/adapt-react-class
. But maybe I'm wrong here.
Thanks @U2FRKM4TW. I got the Select element to render with :require ["react-select" :refer [Select]]
Now on-click of the select item gives
Uncaught Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development. See for more information.
and are you doing any cross origin stuff? ie. loading the JS from a different domain or such?
port itself doesn't matter. was just checking if you use the built-in server or something else
are you sure you are using things correctly? the :refer [Select]
shouldn't have worked at all
@U8KRRN70S He meant whether you do any requests or call something that does some requests.
(ns app.views
(:require
[app.state :refer [app-state]]
[app.events :refer [increment decrement]]
["react-select" :default Select]))
(defn header
[]
[:div
[:h1 "A template for reagent apps"]
[:> Select {:onChange (fn [e]
(js/console.log "onChange" e))
:options
[{:value 1 :label "1"}
{:value 2 :label "2"}]}]])
(ns app.views
(:require [app.state :refer [app-state]]
[app.events :refer [increment decrement]]
[reagent.core :as r :refer [atom]]
["react-select" :default Select]
["prop-types" :refer [PropTypes]]))
(defonce value (r/atom nil))
(defn header
[]
[:div
[:h1 "A template for reagent apps"]])
(defn counter
[]
[:div
[:button.btn {:on-click #(decrement %)} "-"]
[:button {:disabled true} (get @app-state :count)]
[:button.btn {:on-click #(increment %)} "+"]])
(defn select-ui []
[:> js/window.Select {:value @value
:options #js [#js {:value "a" :label "alpha"}
#js {:value "b" :label "beta"}
#js {:value "c" :label "gamma"}]
:onChange #(reset! value (aget % "value"))}])
(defn root-ui []
[:div {:style {:width 400}}
[:h3 "Select test"]
[select-ui]])
js/window.Select
is not what you get from shadow-cljs. thats something else entirely. don't know where tthat is from
if you have a script tag included otherwise you are not actually using the npm package
in general js/
is for accessing global variables which is very common in cljsjs
packages but never required in shadow-cljs
you can follow the translation table here https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages