Fork me on GitHub
#shadow-cljs
<
2018-06-14
>
richiardiandrea00:06:27

I have a problem with :azure-app while compiling with :simple

> var x = require("./query-events")
TypeError: $s$$.substring is not a function
    at Function.cljs.core.subs.cljs$core$IFn$_invoke$arity$2 (/home/arichiardi/git/laputa/lambda-cqrs/cljs/shared.js:9564:15)

levitanong05:06:17

@thheller is it possible for shadow-cljs to :closure js provider for one npm package, but :shadow everywhere else?

thheller05:06:44

@levitanong no, always all or nothing

henrygarner14:06:27

I'm working on migrating a large app over to shadow, playing whack-a-mole migrating existing cljsjs dependencies to their npm equivalents. I've hit up against an issue with clipboard, which causes shadow to throw: > failed to resolve: ./clipboard-action from [redacted]/node_modules/clipboard/dist/clipboard.js > {:relative-to #object[java.io.File 0x624eb05d "[redacted]/node_modules/clipboard/dist/clipboard.js"], :entry "./clipboard-action"} > ExceptionInfo: failed to resolve: ./clipboard-action from [redacted]/node_modules/clipboard/dist/clipboard.js Here's the offending line: https://github.com/zenorocha/clipboard.js/blob/master/dist/clipboard.js#L506

henrygarner14:06:02

I'm not a front-end specialist, but the above looks fishy to me: the /dist directory doesn't contain clipboard-action.js, only /src does. But the /src dir isn't packaged into the module. Does this imply a bug in clipboards packaging: making relative reference to a file which doesn't exist?

thheller15:06:24

oh wait, yes it does

thheller15:06:07

it is scary how bad some packages are built and webpack allowing it instead of complaining 😞

thheller15:06:19

@henrygarner "clipboard/dist/clipboard.min.js" instead of just "clipboard" seems to work

🎉 8
😃 4
justinlee16:06:12

it occurs to me that people don’t actually program in any version of ecmascript anymore. they program in webpack.

thheller16:06:39

indeed 😞

richiardiandrea17:06:22

@thheller your solution with munging is not working on my side

richiardiandrea17:06:35

because the umd helper exports the names unmunged

thheller17:06:49

oh indeed. I was 100% sure the code used munging

richiardiandrea17:06:07

so either the umd starts munging or we use my fix with the array, or if you have any other approach I can work on it

richiardiandrea17:06:42

I also pushed a PR with another fix for the dirs

thheller17:06:07

hmm I don't know whats best. I think munging makes more sense.

richiardiandrea17:06:06

yeah me too, but maybe it is going to cause massive breakage

thheller17:06:03

people using :node-library probably already use :exports {:someVar some.ns/some-var} or :exports {:some_var some.ns/some-var} so its probably ok

thheller17:06:41

doubt that people really want require("./the-lib")["some-var"]

richiardiandrea17:06:53

yeah that is true

thheller18:06:45

added the munge and merged your PR

richiardiandrea18:06:13

cool lemme try 😄

thheller18:06:19

I gotta go, be back later

👍 4
richiardiandrea18:06:48

thanks for the quick fix

nickmbailey20:06:50

any advice on debugging “Timeout while waiting for REPL result.” while trying to require an internal namespace?

thheller20:06:45

@nickmbailey see if the browser console shows an error

nickmbailey20:06:22

didn’t think to look there

wilkerlucio20:06:32

@thheller I noticed that if my code triggers an error on reload (runtime), the shadow HUD stays on screen forever

thheller20:06:27

didnt I fix that? thought I did

wilkerlucio20:06:49

I'm in the latest shadow, so I think it still there

thheller20:06:19

ok. please open an issue. will look into it.

thheller20:06:12

ah right. I only fixed it for errors in callback fns

thheller20:06:38

wonder what the behaviour should be. given that the before-load fns were already called

thheller20:06:56

should it call the after-load fns when the code fails to load or not?

wilkerlucio20:06:52

I would expect it give some feedback and tell that some problem occurred during code load, and I think don't call after-load, like if it was a compilation warning

kenny21:06:46

I have :http-port 3000 in my shadow config but when running shadow-cljs watch app it prints shadow-cljs - HTTP server for :app available at . Why does this happen? It appears the content is available at ports 3000 and 3001.

thheller22:06:49

@kenny if port 3000 is taken it will try 3001. so they may be an old instance hanging around at port 3000 or a different server using it

kenny22:06:24

Oh interesting. I would've expected a warning. I'll investigate.