This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-09
Channels
- # announcements (9)
- # beginners (69)
- # cider (4)
- # clj-kondo (8)
- # cljdoc (1)
- # clojure (52)
- # clojure-austin (4)
- # clojure-europe (22)
- # clojure-nl (2)
- # clojure-norway (14)
- # clojure-uk (3)
- # clojurescript (9)
- # conjure (4)
- # cursive (3)
- # datalevin (13)
- # datomic (4)
- # events (2)
- # fulcro (59)
- # graalvm (17)
- # helix (25)
- # inf-clojure (4)
- # integrant (4)
- # introduce-yourself (2)
- # java (5)
- # kaocha (1)
- # leiningen (3)
- # meander (7)
- # nbb (4)
- # off-topic (30)
- # portal (4)
- # rdf (1)
- # reagent (5)
- # sci (1)
- # shadow-cljs (57)
- # sql (8)
- # tools-deps (39)
- # uncomplicate (3)
- # vim (3)
- # xtdb (8)
shadow.loader/load
is working in dev, but not in release. The error is CustomError: Error loading <module>: Consecutive load failures
and the stacktrace is just as cryptic.. any troubleshooting ideas? The xhr to get the .js file does succeed but it's fetched 3 times and fails after the 3rd.
is your server sending the correct response? usually the only happens when the server doesn't send the proper .js file?
successful request unfortunately doesn't mean it contained the proper JS. could be sending some HTML instead
(function(){
shadow$provide[390]=function(ya,Ba,Ja,Ra){var qa=Ba(156);Ja.exports=function(){return qa.Date.now()}};
shadow$provide
looks like it waits 5, then 20 secs between retries, then errors.. you'd think there would be some logging
yeah the closure loader is not great when it comes to errors. usually there shouldn't be any though
could be an error during load. try loading the files directly from the html if you can
good call, making progress.
Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
looks like there's a mistake in my routing+loading system somewhere as the error points to this line
$APP.$reitit$core$t_reitit$0core609782$$.prototype.$reitit$core$Router$routes$arity$1$ = $JSCompiler_unstubMethod$$(5, function() {
return this.$routes$;
});
a very annoying issue related to reify
in CLJS. https://clojure.atlassian.net/browse/CLJS-3207
Hi all, newbie here.. I'm getting following error when compiling with target :node-library
, and just wanted to ask here in case it's due to a simple oversight on my part.. it seems that async_hooks
is a node-core-module, do I have to treat core-modules in a special way to make them available?
The required JS dependency "async_hooks" is not available, it was required by "node_modules/raw-body/index.js"
uhm that error doesn't make sense. is this one of your files node_modules/raw-body/index.js
? node-library doesn't process npm packages, so this weird
and how did you require it? should be (:require ["async_hooks" :as x])
, not (:require [async_hooks :as x])
. ie a string not a symbol
thanks for the quick response! I love shadow-cljs, awesome user experience!! 🔥
node_modules/raw-body/index.js
is not one of my files, probably pulled in in my import of express (:require ["express" :as express])
The required JS dependency "async_hooks" is not available, it was required by "node_modules/raw-body/index.js".
Dependency Trace:
shadow/umd_helper.cljs
test/lambdas/checkout.cljs
node_modules/express/index.js
node_modules/express/lib/express.js
node_modules/body-parser/index.js
node_modules/body-parser/lib/types/json.js
node_modules/body-parser/lib/read.js
node_modules/raw-body/index.js
Searched for npm packages in:
/Users/user/dev/checkout/node_modules
could be a misunderstanding on my side how npm and node work, or shadow.. I think I've configured it based on your example of deploying a function to netlify
:stripe-checkout {:target :node-library
:output-to "landing/functions/checkout.js"
:exports {:handler test.lambdas.checkout/handler}
:js-options
{:js-provider :shadow
:keep-native-requires true}
:devtools
{:enabled false}}
depends on the deployment. best to just let node load the dependencies, and just have shadow-cljs build the CLJS
but that requires that the runtime can load npm packages. some can, some can't. not sure what you are deploying to
so you mean don't bundle any npm packages, because node will load them from node_modules? if I understood it right, that should work, because I'm deploying to netlify functions, and in the deployment it will install packages.json.
yeah if the runtime can install npm packages its best to just remove :js-options
from the config above
Is it possible to create a release build for a npm-module
target?
I’m running into some issues when bundling the output with many errors like:
cljs-dist/cljs_env.js does not export 'Nf'
> 1 | var window=global;var $CLJS=require("./cljs_env");require("./cljs_env.js");
> 2 | 'use strict';$=require("react");module.exports=$;
> |
And when I look at the cljs_env.js
file, none of those fields exist. I’m using :advanced
optimizations as well.
Do I need to create some kind of externs file or something? It seems like the optimizations are removing those fields, but I’m not sure. Any ideas?what does cljs-dist/cljs_env.js does not export 'Nf'
mean? its not supposed to be exported? what is generating this error?
in fact what is generating this source at all? this doesn't look like npm-module output?
That’s generated by running the release
command with shadow using this config:
{:source-paths ["src"]
:dependencies [[reagent "1.1.1"]]
:builds {:app {:output-dir "./cljs-dist"
:target :npm-module
:entries [app.main]
:release {:compiler-options {:optimizations :advanced}}}}}
cljs-dist/cljs_env.js does not export 'Nf'
refers to some mangled name that is supposed to be exported on the global $CLJS
object / module
But for some reason those fields are removed after the release build finishes. And when I try to use a tool like Webpack (in this case Parcel), the JS bundler reports that error
removing stuff is normal and expected. $
$CLJS
is the global object
besides an error message I do not recognize and must be coming from other 3rd party tools
so the question is: what is generating cljs-dist/cljs_env.js does not export 'Nf'
? the error message I mean. the code is fine from what I can tell?
hmm nvm. the code is broken. cljs-dist/cljs_env.js
requiring cljs_env is indeed a bug, that should not be