Fork me on GitHub
#shadow-cljs
<
2018-07-08
>
justinlee01:07:22

@urbanslug you can import using the default keyword (see shadow user manual) or just access the property named “default”

urbanslug04:07:24

@lee.justin.m I swear I gleaned over this manual a couple of times and didn't see this

mhuebert14:07:11

Hmm, trying to use the aws-sdk package and it is bundling the node.js version:

(ns my-ns.aws 
  (:require ["aws-sdk/lib/util" :as util]))

(prn [(util/isNode) (util/isBrowser)])
;; => [true false]
in the aws-sdk package.json there are some "browser" settings which maybe aren’t being read?
"browser": {
    "lib/aws.js": "./lib/browser.js",
    "fs": false,
    "./global.js": "./browser.js",
    "./lib/node_loader.js": "./lib/browser_loader.js"
  },

mhuebert14:07:39

there is a also this field

"browserify": {
    "transform": "./dist-tools/transform.js"
  },

thheller15:07:27

which target? :browser?

thheller15:07:26

hehe that result is kind of hilarious

thheller15:07:50

isBrowser: function isBrowser() { return process && process.browser; },
  isNode: function isNode() { return !util.isBrowser(); },

thheller15:07:37

very sophisticated checking logic 😉

thheller15:07:03

but the check should succeed. checking why it doesn't

thheller15:07:50

try setting :closure-defines {shadow.js.process.browser true}

thheller15:07:03

thats supposed to be set for :browser target by default but for some reason isn't

mhuebert15:07:58

👍:skin-tone-2: that works

thheller15:07:15

yeah browser target only set this for release builds

thheller15:07:30

will fix but setting it manually is fine for now

mhuebert15:07:02

great. i was worried this would be related to some weirdness with how the aws-sdk package is built

thheller15:07:24

the browser field in package.json is fully supported. its just that checked that failed