This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-11
Channels
- # beginners (57)
- # boot (9)
- # clara (9)
- # cljs-dev (12)
- # clojure (98)
- # clojure-boston (1)
- # clojure-dusseldorf (12)
- # clojure-france (1)
- # clojure-greece (1)
- # clojure-spec (41)
- # clojure-uk (86)
- # clojurescript (60)
- # code-art (2)
- # data-science (5)
- # datomic (5)
- # duct (1)
- # fulcro (14)
- # graphql (2)
- # lein-figwheel (4)
- # luminus (1)
- # midje (1)
- # off-topic (19)
- # om (10)
- # onyx (13)
- # pedestal (5)
- # portkey (59)
- # re-frame (31)
- # reagent (1)
- # ring (14)
- # ring-swagger (1)
- # rum (5)
- # shadow-cljs (90)
- # spacemacs (5)
- # specter (47)
- # sql (9)
- # uncomplicate (95)
- # vim (32)
I think it would be useful to have a feature to allow control over "where" resolution for a build. Discussed previously was that you get issues with the current design of "if it's in node_modules, just use that" in case you're separately building a frontend project in the same directory OR you have multiple builds within the same JVM of which you want to have different behaviour.
I solved this in shadow-cljs by adding a :resolve
config which basically allows “redirecting” what a certain (:require ["thing" :as x])
does by name
:js-options
{:resolve
{"react"
{:target :npm
:require "react/cjs/react.development.js"
:require-min "react/cjs/react.production.min.js"}
"react-dom"
{:target :npm
:require "react-dom/cjs/react-dom.development.js"
:require-min "react-dom/cjs/react-dom.production.min.js"}
"jquery"
{:target :global
:global "jQuery"}
"something"
{:target :file
:file "some-path/to/file.js"}}}
totally agree that there should be something like this in core since its per-build (which deps.cljs is unsuited for)
https://code.thheller.com/blog/shadow-cljs/2017/09/15/js-dependencies-going-forward.html
:js-provider
is also useful, since a :node-script
will pretty much always want to use direct require
Is it a known problem that during incremental compilation paths to scoped NPM packages (`@scope/pkg-name`) are being lost? Happens after very first re-compilation.
Getting the following error at runtime: Undefined nameToPath for path/to/npm/pkg
Happens with NPM packages defined in deps.cljs
in dependencies.
may also be this https://dev.clojure.org/jira/browse/CLJS-2378
@mhuebert Hmm, at least :compiler-options :foreign-libs
should take precedence over dependencies, I thought local deps.cljs
would also work