This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-20
Channels
- # announcements (1)
- # babashka (74)
- # beginners (84)
- # bristol-clojurians (3)
- # cider (2)
- # clara (14)
- # cljdoc (18)
- # cljsrn (7)
- # clojure (29)
- # clojure-australia (4)
- # clojure-europe (34)
- # clojure-italy (3)
- # clojure-nl (5)
- # clojure-seattle (1)
- # clojure-uk (33)
- # clojuredesign-podcast (2)
- # clojurescript (33)
- # code-reviews (17)
- # core-async (10)
- # cursive (8)
- # datomic (21)
- # depstar (45)
- # dirac (4)
- # duct (10)
- # emacs (1)
- # fulcro (8)
- # jackdaw (2)
- # jobs (1)
- # kaocha (11)
- # leiningen (2)
- # off-topic (8)
- # pathom (35)
- # pedestal (3)
- # protorepl (13)
- # rdf (39)
- # re-frame (23)
- # reagent (2)
- # releases (1)
- # remote-jobs (6)
- # reveal (2)
- # rewrite-clj (18)
- # shadow-cljs (51)
- # sim-testing (2)
- # spacemacs (2)
- # tools-deps (37)
I am getting a harmless error
Parse error. illegal use of unknown JSDoc tag "pd"; ignoring it
doing a release build, when it gets to this line in a library I am using: https://github.com/ptaoussanis/tufte/blob/master/src/taoensso/tufte.cljc#L315
There is a comment with a code snippet ending @pd. ANy way to quiesce that? Not a big deal at all.@kenny there is an option but I can't remember the name. I'll try to look it up later.
@mail024 what are "duplicate require issues"? for now :npm-module
should sort of work. :esm
is sort of finished except for a "do not bundle X packages" setting I guess
@thheller I keep trying to shoehorn shadow-cljs into lots of different contexts, and thinking about it, it would be helpful if you could provide new :target
's as plugins/extensions to shadow-cljs, to keep the core smaller and not having to implement everything in shadow-cljs. Something you thought about?
all the default targets are implemented this way https://github.com/thheller/shadow-cljs/tree/master/src/main/shadow/build/targets
guessing it just has to be available on the classpath and it'll pick it up from there?
yes its just a regular function you implement that inspects some keys to know what it is supposed to do
I recommend looking at simple targets like node-script https://github.com/thheller/shadow-cljs/blob/80b00a6bd61537c3a4dbcaece1f7555234cc2d87/src/main/shadow/build/targets/node_script.clj#L66
:browser
is by far the most complicated so can be hard to understand what is happening
this is one of the custom targets someone else wrote as a lib https://github.com/titonbarua/shadow-cljs-gjs-target
@thheller duplicate require was a bad way to name it. I meant Namespace "xxx" already declared
. Happens for both esm and npm-module. I think i remember similar things happening a little while back when I tried to import cljs code from shadow in webpack.
Error: Namespace "cljs.core" already declared.
at Object.goog.provide (webpack-internal:///./dist/cljs/cljs-runtime/cljs_env.js:102:13)
at eval (webpack-internal:///./dist/cljs/cljs-runtime/cljs.core.js:4:6)
at Module../dist/cljs/cljs-runtime/cljs.core.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:199:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./dist/cljs/index.js:41:85)
at Module../dist/cljs/index.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:2298:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./pages/index.js:2:77)
at Module../pages/index.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:2310:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
Super cool about the target thing mentioned above!
A single one. I can get you a repro project if thats useful.
;; shadow-cljs configuration
{:source-paths
["src/dev"
"src/main"
"src/test"]
:dependencies
[[reagent "0.8.1"]]
:builds
{:site {:target :npm-module
:output-dir "site/src/cljs"
:build-hooks [(shadow.next-js/create-pages)]
:entries []}
:esm {:target :esm
:output-dir "dist/cljs"
:build-hooks [(shadow.next-js/create-pages)]
:modules {:index {:exports {page_index }}}}}}
Let me push a repro project
repro is for esm
npm run dev
shadow-cljs watch esm
actually. Sorry, should remove the build hook for esm. Will fix
Also to note, on latest shadow last night I ran into an issue where I changed the shadow-cljs output-dir for either the npm-module or esm and even after restarting shadow watch, it was still outputting to the old dir. Deleting .shadow-cljs fixed it. Possible i had a shadow server running somewhere in emacs while this happened but i dont think i did
scratch that, I think i did have a shadow-cljs server running
ok. I’ve pushed a clean repro case for issues with next-js (although i think this is webpack reproducible as well) and esm. Super simple import. From fresh next and shadow cache. Terminal history is as follows:
> [email protected] dev /Users/alexisvincent/Code/next-cljs
> next dev
ready - started server on
event - compiled successfully
event - build page: /
wait - compiling...
[BABEL] Note: The code generator has deoptimised the styling of /Users/alexisvincent/Code/next-cljs/dist/esm/cljs-runtime/cljs.pprint.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/alexisvincent/Code/next-cljs/dist/esm/cljs-runtime/cljs.pprint.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/alexisvincent/Code/next-cljs/dist/esm/cljs-runtime/cljs.core.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/alexisvincent/Code/next-cljs/dist/esm/cljs-runtime/cljs.core.js as it exceeds the max of 500KB.
warn - ./dist/esm/cljs-runtime/cljs_env.js
Critical dependency: the request of a dependency is an expression
info - ready on
ReferenceError: WebSocket is not defined
at shadow$cljs$devtools$client$websocket$start (webpack-internal:///./dist/esm/cljs-runtime/shadow.cljs.devtools.client.websocket.js:9:16)
at shadow.cljs.devtools.client.shared.Runtime.attempt_connect_BANG_ (webpack-internal:///./dist/esm/cljs-runtime/shadow.cljs.devtools.client.shared.js:507:131)
at Object.shadow$cljs$devtools$client$shared$init_runtime_BANG_ [as init_runtime_BANG_] (webpack-internal:///./dist/esm/cljs-runtime/shadow.cljs.devtools.client.shared.js:978:18)
at eval (webpack-internal:///./dist/esm/cljs-runtime/shadow.cljs.devtools.client.browser.js:989:38)
at Module../dist/esm/cljs-runtime/shadow.cljs.devtools.client.browser.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:2046:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./dist/esm/index.js:130:112)
at Module../dist/esm/index.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:2286:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./pages/index.js:2:76)
Error: Namespace "shadow.cljs.devtools.client.browser" already declared.
at Object.goog.provide (webpack-internal:///./dist/esm/cljs-runtime/cljs_env.js:102:13)
at eval (webpack-internal:///./dist/esm/cljs-runtime/shadow.cljs.devtools.client.browser.js:5:6)
at Module../dist/esm/cljs-runtime/shadow.cljs.devtools.client.browser.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:2046:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./dist/esm/index.js:130:112)
at Module../dist/esm/index.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:2286:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./pages/index.js:2:76)
at Module../pages/index.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:2298:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
event - build page: /next/dist/pages/_error
wait - compiling...
event - build page: /next/dist/pages/_error
warn - ./dist/esm/cljs-runtime/cljs_env.js
Critical dependency: the request of a dependency is an expression
info - ready on
warn - ./dist/esm/cljs-runtime/cljs_env.js
Critical dependency: the request of a dependency is an expression
info - ready on
Error: Namespace "cljs.core" already declared.
at Object.goog.provide (webpack-internal:///./dist/esm/cljs-runtime/cljs_env.js:102:13)
at eval (webpack-internal:///./dist/esm/cljs-runtime/cljs.core.js:4:6)
at Module../dist/esm/cljs-runtime/cljs.core.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:199:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./dist/esm/index.js:41:85)
at Module../dist/esm/index.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:2286:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./pages/index.js:2:76)
at Module../pages/index.js (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:2298:1)
at __webpack_require__ (/Users/alexisvincent/Code/next-cljs/.next/server/pages/index.js:23:31)
Have now added an npm-module case. Which works! I must have had bad caches yesterday? What doesn’t work however is interplay between hmr from webpack and shadow. I expect here that I could leave hmr up to shadow by using compile. But then i still want to have a shadow server for repl and hmr, how do I do this? Im assuming some combination of compile and server?
esm compile works, but fails for other reasons I dont think are related to shadow. Thanks! Having a way for shadow to do hmr but bypassing the flush step to avoid next attemping to hmr cljs code would be great. Do you know how i might achieve this?
Ok, thanks for the input. I’ll get some time to look closer into this tomorrow. Goal is to get reliable interplay between shadow and nextcljs
I believe I said it is not a good match for CLJS and it still isn't and never will be great
yeah, I got the same impression last time I looked at next.js, doesn't seem to fit with clojurescript development really. Question for people who used next.js more though, what exactly are you missing in cljs devlopment that next.js gives you? Might be something better in the ecosystem to give you the same or greater benefits
Hi, @thheller, I just found a really strange issue 😄. On Chlorine, I evaluate all shadow-cljs commands by treating the result - so they all go inside a let
.
So, if I do something like this:
(let [res (ns some.namespace (:require ["js-dependency" :as dependency]))] res)
And then try do define a function: (defn a-fn [] (.useThis dependency)
It breaks with:
AssertionError Assert failed: (symbol? module)
shadow.build.cljs-hacks/js-module-exists? (cljs_hacks.cljc:71)
shadow.build.cljs-hacks/js-module-exists? (cljs_hacks.cljc:71)
shadow.build.cljs-hacks/invokeable-ns? (cljs_hacks.cljc:109)
shadow.build.cljs-hacks/invokeable-ns? (cljs_hacks.cljc:104)
If I don't wrap the ns
form in a let
, it works fine. It's not a big deal, really - Shadow's hot-reload makes evaluating ns
forms unnecessary, but I thought I would explain the issue anyway 😄
@mauricio.szabo ns
is a special form which you cannot put into a let in CLJS
Yes, the simple fact that it works sometimes is something that amazes me 😄.
For example, load-file
simply do not work if you wrap on let
The result of the first command is nil
, so it does run... to some extend