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?
might be ["ziggy-js" :as route]
see https://shadow-cljs.github.io/docs/UsersGuide.html#_about_default_exports
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 unsuccessfulIs 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)
don't know what cypress is. where do you get this error? shadow doesn't generate import
statements anywhere. unless you are using :target :esm
?
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?
:asset-path
controls that