Description
I'm experimenting with a project setup where I develop both the main library and a dependency at the same time. I have both repositories local on my machine during development. This works well enough if I npm install
the dependency from the local filesystem, but then I need to reinstall after every change in the dependency. I would like to use npm link
to solve this, but bsb
is producing incorrect paths for es6-global
modules when I try.
Given the folder structure in the attached tarball, run the following commands:
cd foo
npm link bs-platform ../bar
bsb -make-world
If you then cat lib/es6_global/src/foo.js
, Bar is referenced as import * as Bar from "../../../node_modules/bar/lib/es6_global/src/bar.js";
which is loading it via the symlink.
However, if you cat node_modules/bar/lib/es6_global/src/bar.js
, the path to the stdlib is wrong:
import * as $$String from "../../../../foo/node_modules/bs-platform/lib/es6/string.js";
This appears to have resolved the real filesystem location of the stdlib in foo
relative to bar.js
, ignoring the fact that it was compiled as a symlinked dependency. In other words it will work if bar.js
is loaded from the real filesystem location, but not the symlink location (and as shown above foo.js
is loading it through the symlink).
I can think of two solutions:
- When compiling
bar
, use stdlib references that work via the symlink - When compiling
foo
, refer tobar
through the actual filesystem location instead of via the symlink
I don't think option 1 is really viable though, as it would mean that moving back to working in the bar
project directly leaves you with compiled output that no longer works.