This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-23
Channels
- # announcements (1)
- # asami (2)
- # aws (15)
- # babashka (4)
- # beginners (42)
- # calva (8)
- # clj-kondo (7)
- # cljsrn (31)
- # clojure (64)
- # clojure-australia (4)
- # clojure-europe (40)
- # clojure-italy (2)
- # clojure-nl (5)
- # clojure-uk (10)
- # clojured (1)
- # clojurescript (16)
- # conjure (4)
- # datomic (5)
- # defnpodcast (2)
- # events (1)
- # fulcro (61)
- # graphql (11)
- # honeysql (9)
- # jobs (3)
- # jobs-discuss (3)
- # lsp (65)
- # malli (3)
- # meander (4)
- # off-topic (5)
- # pathom (32)
- # podcasts-discuss (2)
- # polylith (2)
- # re-frame (30)
- # reitit (6)
- # remote-jobs (3)
- # ring (4)
- # shadow-cljs (19)
- # sql (28)
- # vim (1)
- # xtdb (21)
Hi, I never had the case so far. How to import a js module outside "node_modules" via its relative path like
import { Ziggy } from './ziggy.js';
I'll tried :require ["./ziggy.js" :refer [Ziggy]]
I'm asking here and not on #clojurescript because I think Shadow-cljs offers more possibilities for imports, right?
That all right, it works. I also found the :js-options
:resolve
who seems perfect to avoid complected relative paths. 👍
@admin055 do not use :resolve
. if you have the file on the classpath (which you should) just use either the relative path or the full path (:require ["/some/file.js"])
following classpath rules
OK thanks for the advice and confirmation. Another question, I tried to import/require this lib ziggy-js but without success: https://github.com/tighten/ziggy/blob/main/src/js/index.js#L3
I have already tried what I usually do, i.e.
["ziggy-js" :refer [route]]
or
["ziggy-js" :default route]
But it doesn't works. Any clue?
Yep it works. 👍 The part with the REPL workflow to debug the imports is very interesting and useful. Thx
I’m trying to get Cypress working with some shadow-cljs builds but keep getting this error:
Cannot use import statement outside a module
Tried release
and watch
builds, both unsuccessfuldon't know what cypress is. where do you get this error? shadow doesn't generate import
statements anywhere. unless you are using :target :esm
?
Is it possible to import raw .jsx files? When I import as such:
["./surveyjs/widgets/RatingWidget.jsx" :refer [RatingWidget]]
I get:
> cannot identify as cljs resourceah i think it needs to be preprocessed (https://shadow-cljs.github.io/docs/UsersGuide.html)
That worked :thumbsup:
npx babel *.jsx --out-dir gen
Hi! I have javascript hosted on different URL from application it self and it works ok for main module. When I have multiple modules then they are loaded from relative path to index.html. This problem I notices on mobile when packaging using cordova, main.js comes from https://example.com/main.js but then my module is loaded from http://127.0.0.1/module.js. Can I somehow adjust URLS for modules?