Fork me on GitHub
#shadow-cljs
<
2020-08-05
>
rberger06:08:44

I’m trying to import IconContext for react-icons I’ve been able to import the actual icons ok, but I need to import IconContext for changing the Icon’s attributes. I’ve tried:

["react-icons" :default IconContext]
["react-icons" :refer (IconContext)]
["react-icons" :as IconContext] # I know that one shouldn't work but tried anyway
And I always get:
[:app] Build failure:
package in /Users/rberger/omnyway/visx/visx-shopper-app/node_modules/react-iconsspecified entries but they were all missing
{:tag :shadow.build.npm/missing-entries, :entries ["lib"], :package-dir #object[java.io.File 0x627fddf1 "/Users/rberger/omnyway/visx/visx-shopper-app/node_modules/react-icons"]}
ExceptionInfo: package in /Users/rberger/omnyway/visx/visx-shopper-app/node_modules/react-iconsspecified entries but they were all missing
Any idea what I’m doing wrong? The Original react-icons doc for the import is at: https://github.com/react-icons/react-icons#configuration

thheller08:08:24

@rberger hmm try "react-icons/lib/cjs/index.js" for now. the package seems to be bundled rather strangely

awb9908:08:13

Hi @thheller I observed the following behavior: deps.cljs file in src/ works (= dependencies are added to package.json). deps.cljs in src/pinkgorilla -> does not work (dependencies not added to package.json). I am not sure if this is intentionally or not.

thheller08:08:03

deps.cljs must always be in the "root" of the classpath. it does not work anywhere else.

awb9908:08:42

I think a warning might make sense here.

awb9908:08:10

Mot ides now collapse multiple folders into one line.

awb9908:08:42

And there is not really any way to tell if the resource has been placed correctly or not.

awb9908:08:18

I dont care anymore for my project, as I have he location correct.

awb9908:08:45

But I think this is a potential to other people that is pretty much impossible to see.

awb9908:08:15

And I guess it just needs a regex to detect.

awb9908:08:30

A you must be scanning all resources anyhow in some way.

awb9908:08:42

Just my feedback as a user...

thheller08:08:39

not interested. pinkgorilla.deps would be a completely ok namespace and checking every possible deps.cljs file whether its an actual ns or not is not practical.

superstructor10:08:26

@thheller NPM deps that are already in package.json get filtered out by https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/devtools/server/npm_deps.clj#L222 Or in other words, if all the deps that shadow-cljs is responsible for are already in package.json shadow-cljs does not run any npm install command at all ? Does that mean that the intended behaviour is that its a user's responsibility to run npm install prior to shadow-cljs manually or via another build tool ?

thheller11:08:42

@superstructor the intention is that users manage their own packages yes. shadow-cljs is not a package manager.

superstructor12:08:24

ok thanks @thheller 👍

dmitryn13:08:57

Hello, how to make js/URL to be resolved to custom class (like URL from react-native-url-polyfill) ? Or in general, how to change global var like js/window or js/document ?

dmitryn13:08:07

I’m trying to use this in config

:js-options {:resolve {"react-native-url-polyfill" {:target :global
                                                                       :global "URL"}}}

dmitryn13:08:02

But it doesn’t seem to work

thheller19:08:15

nothing can affect what js/URL resolves to. it literally means use the global URL object, whatever that may be.

thheller19:08:30

just don't use js/URL if you want to change it?

dmitryn21:08:27

There is other code relying on URL to be globally available and I cannot change that code, but would like to provide my own URL implementation

thheller22:08:29

ah. you can do (js/goog.exportSymbol "URL" whatever-it-should-be) in a namespace that is loaded before the one using it

dmitryn07:08:22

thanks, that seems what it needs!