This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-06
Channels
- # announcements (1)
- # aws (36)
- # babashka (105)
- # beginners (53)
- # calva (27)
- # cider (5)
- # clj-kondo (10)
- # clojure (232)
- # clojure-europe (4)
- # clojure-italy (6)
- # clojure-losangeles (9)
- # clojure-nl (3)
- # clojure-sanfrancisco (3)
- # clojure-uk (124)
- # clojured (3)
- # clojurescript (57)
- # clojutre (1)
- # core-async (9)
- # core-logic (1)
- # cryogen (23)
- # cursive (35)
- # datomic (12)
- # duct (4)
- # events (1)
- # figwheel-main (3)
- # fulcro (9)
- # graalvm (31)
- # jobs (1)
- # jobs-discuss (85)
- # kaocha (11)
- # leiningen (11)
- # luminus (19)
- # malli (47)
- # meander (12)
- # nrepl (8)
- # off-topic (32)
- # pathom (4)
- # pedestal (2)
- # reagent (7)
- # ring-swagger (1)
- # schema (3)
- # sql (5)
- # tools-deps (114)
- # vim (17)
- # xtdb (12)
Surprise Reagent release (no huge new features, yet): https://github.com/reagent-project/reagent/blob/master/CHANGELOG.md#0100-2020-03-06 !
Hi, I use shadow-cljs and I'm experiencing some issue regarding the import of the roughjs
npm package.
The installation of the package have been done by npm command npm i roughjs
. In the application code, I have:
(ns
(:require ["roughjs" :default rough]
)
)
[...]
When I try to compile this shadow-cljs compile app
, I get the following error messages:
[:app] Compiling ...
Closure compilation failed with 9 errors
--- node_modules/roughjs/bundled/rough.js:2
Class names defined inside a function cannot be reassigned.
--- node_modules/roughjs/bundled/rough.js:2
Class names defined inside a function cannot be reassigned.
--- node_modules/roughjs/bundled/rough.js:2
Class names defined inside a function cannot be reassigned.
--- node_modules/roughjs/bundled/rough.js:2
Class names defined inside a function cannot be reassigned.
--- node_modules/roughjs/bundled/rough.js:2
Class names defined inside a function cannot be reassigned.
--- remaining errors ommitted ...
As the bundled/rough.js
is a uglyfied code, it's really hard to investigate.
Does anyone have a hint on how I can import correctly this package please?@fabien.rozar try ["roughjs/bundled/rough.esm.js" :default rough]
. dunno why it doesn't like the default bundle
Great, that works! I don't why the default bundle is not accepted, but happy the application is working 😸
Actually, I'm trying to put in place some test in the project. My test file is as simple as that:
(ns rough.app-test
(:require [ :as app]
[cljs.test :refer (deftest is)]))
(deftest a-failing-test
(is (= 1 2)))
When I try the command shadow-cljs compile test
, I get an error regarding the import (again) or js syntax issue:
[:test] Compiling ...
========= Running Tests =======================
SHADOW import error /home/frozar/wk/cljs_roughjs/.shadow-cljs/builds/test/dev/out/cljs-runtime/shadow.js.shim.module$roughjs$bundled$rough_esm.js
/home/frozar/wk/cljs_roughjs/node_modules/roughjs/bundled/rough.esm.js:1
const t="";function e(t,e,s){if(t&&t.length){const[n,i]=e,a=Math.PI/180*s,o=Math.cos(a),h=Math.sin(a);t.forEach(t=>{const[e,s]=t;t[0]=(e-n)*o-(s-i)*h+n,t[1]=(e-n)*h+(s-i)*o+i})}}function s(t){const e=t[0],s=t[1];return Math.sqrt(Math.pow(e[0]-s[0],2)+Math.pow(e[1]-s[1],2))}function n(t,e){return t.type===e}const i={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:4,t:2,V:1,v:1,Z:0,z:0};class a{constructor(t){this.COMMAND=0,this.NUMBER=1,this.EOD=2,this.segments=[],this.parseData(t),this.processPoints()}tokenize(t){const e=new Array;for(;""!==t;)if(t.match(/^([ \t\r\n,]+)/))t=t.substr(RegExp.$1.length);else if(t.match(/^([aAcChHlLmMqQsStTvVzZ])/))e[e.length]={type:this.COMMAND,text:RegExp.$1},t=t.substr(RegExp.$1.length);else{if(!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];e[e.length]={type:this.NUMBER,text:`${parseFloat(RegExp.$1)}`},t=t.substr(RegExp.$1.length)}ret
SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1067:16)
at Module._compile (internal/modules/cjs/loader.js:1115:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1040:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /home/frozar/wk/cljs_roughjs/.shadow-cljs/builds/test/dev/out/cljs-runtime/shadow.js.shim.module$roughjs$bundled$rough_esm.js:3:51
at global.SHADOW_IMPORT (/home/frozar/wk/cljs_roughjs/out/node-tests.js:64:44)
at /home/frozar/wk/cljs_roughjs/out/node-tests.js:2258:1
===============================================