I currently have 2 shadow-cljs projects with 2 different ways to manage their dependencies to npm libraries.
One uses the default shadow-cljs.edn configuration :js-options {:js-provider :shadow}, we will call it project A.
The other, we will call it project B, uses the external configuration with the use of webpack inside the shadow-cljs.edn file :js-options {:js-provider :external :external-index "target/index.js"} as described in the following article How about webpack now?
Locally I can run these project A and project B independently without errors.
However, I would now like to import project A into project B, and use the method my-function from project_A.core.
(ns project_A.core) (defn ^:export my-function [] ...) I tried to release project A by specifying the :target field of the shadow-cljs.edn file to the value :npm-module.
Project A > shadow-cljs.edn :
{ [...] :builds {:app {:target :npm-module :output-dir "release/" :entries [project_A.core] :js-options {:js-provider :external :external-index "target/index.js"}}} [...] }} Then I install it in project B i did a npm install path/to/project_A, as for a classic npm package and to use it the same way as the others.
I tried to add the local dependency like this:
Project B > package.json :
{ "scripts": {[...]}, "devDependencies": {[...]}, "dependencies": { [...] "project_A": "file:path/to/project_A", [...] }, "name": "projet B", } And I try to import the package inside the ns require field. However project B does not compile.
Is there a clean way to import a project into the other one while taking into account their different configuration?