This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-26
Channels
- # announcements (3)
- # babashka (28)
- # beginners (21)
- # cider (29)
- # clojars (10)
- # clojure (14)
- # clojure-australia (3)
- # clojure-europe (48)
- # clojure-nl (3)
- # clojure-sanfrancisco (4)
- # clojure-uk (54)
- # clojurescript (34)
- # cryogen (12)
- # cursive (7)
- # datomic (14)
- # devcards (1)
- # fulcro (23)
- # helix (2)
- # java (5)
- # jobs (1)
- # kaocha (15)
- # malli (13)
- # minimallist (1)
- # off-topic (8)
- # pathom (7)
- # pedestal (1)
- # rdf (10)
- # reagent (18)
- # shadow-cljs (58)
- # spacemacs (3)
- # tools-deps (1)
- # vim (6)
- # xtdb (37)
Q: I’m struggling with an npm dep failing in nodejs CI tests. The error is opt/atlassian/pipelines/agent/build/node_modules/uuid/dist/esm-browser/index.js:1
but I can’t work out how to get it to use the node variant instead. I’ve tried nearly everything in the docs about npm deps e.g. “module” entrypoints etc but no luck
{:target :node-test
:compiler-options {:optimizations :none}
:js-options {:entry-keys ["module" "main"]} ; using esm modules (for uuid npm dep) see
:output-to "cljs-out/test/node-tests.js"
:ns-regexp "-test$"
; autorun does not return an exit code suitable for CI. CI tests are runs from node cli instead
:autorun false}
@U0510KXTU opt/atlassian/pipelines/agent/build/node_modules/uuid/dist/esm-browser/index.js:1
is not an error. that is a filename. what is the actual error?
+ node cljs-out/test/node-tests.js
SHADOW import error /opt/atlassian/pipelines/agent/build/.shadow-cljs/builds/test-ci/dev/out/cljs-runtime/shadow.js.shim.module$uuid.js
/opt/atlassian/pipelines/agent/build/node_modules/uuid/dist/esm-browser/index.js:1
export { default as v1 } from './v1.js';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1043:16)
at Module._compile (internal/modules/cjs/loader.js:1091:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (internal/modules/cjs/helpers.js:69:18)
at /opt/atlassian/pipelines/agent/build/.shadow-cljs/builds/test-ci/dev/out/cljs-runtime/shadow.js.shim.module$uuid.js:3:30
at global.SHADOW_IMPORT (/opt/atlassian/pipelines/agent/build/cljs-out/test/node-tests.js:64:44)
at /opt/atlassian/pipelines/agent/build/cljs-out/test/node-tests.js:1839:1
@U05224H0W my naive reading of this is that the shim is running the browser impl when it’s in a nodejs build. Am I wrong about this?
Welcome to Node.js v12.12.0. Type “.help” for more information. > require(“uuid”) { v1: [Getter], v3: [Getter], v4: [Getter], v5: [Getter], NIL: [Getter], version: [Getter], validate: [Getter], stringify: [Getter], parse: [Getter] } >
> require.resolve(“uuid”) ‘/Users/steve/Documents/dev-personal/nextdoc-cloud/components-portable/node_modules/uuid/dist/index.js’ >
it’ll take me a bit of time (docker) to check node versions. would that be a likely cause?
I don't know honestly. none of the js-options
will do anything since node is responsible for picking the JS dependency. which you can see from the stacktrace.
yeah ok. I will look into the package-lock as well. thanks for taking a first pass at this
As of Node.js 12.17.0, the --experimental-modules flag is no longer necessary to use ECMAScript modules (ESM).
seems kinda weird that it picks the module
entry but then doesn't understand modules 😛
Hey! Is there a recommended way to hack on two libraries at once, similar to lein checkouts? I didn't really find anything besides some recommendations to just softlink part of the source tree.
Ah, I found something in the slack archive:
@lilactown just add the :source-paths and keep it in :dependencies. or you use the lein integration
Thanks, will try that firstAh, I found something in the slack archive:
@lilactown just add the :source-paths and keep it in :dependencies. or you use the lein integration
Thanks, will try that firstIf you're using the re-frame template, there's a parameter to include a compojure server for fullstack development, that might offer a start!
I like re-frame, it uses shadow cljs and has the Clojure setup built in, but there are probably others as well
Hm, then I'd just use the re-frame template for an example how the integration works (It's pretty straightforward), and then go with the reagent template: https://github.com/reagent-project/reagent-template