# Link NPM Packages
When you want to use linked package within docker image you can't just use npm link because of file system.
Solution is mount your package into docker and then create link inside docker.
Every project supporting this feature should have some info in README.
# Usage
In docker-compose.override.yml create mapped volume targeting to directory /shared.
Entrypoint will automatically link everything in that directory.
version: "3.5"
services:
app:
volumes:
- ~/smartsupp/backend-shared/packages/koa-middlewares:/shared/koa-middlewares
# Implementation
If you want to adopt this feature then:
- and add info into readme that this feature is supported
- into entrypoint put this snippet:
if [ -d "/shared" ]; then
for dir in /shared/*/
do
if [ -d "$dir" ]; then
echo "Linking $dir"
npm link "$dir"
fi
done
fi