I'm using VSCode to work on a NodeJS project on a second (remote) machine. This project runs in a Docker container on that second machine. I don't like relative imports, so I try to avoid them. I do like automatic imports, so I try to use them as much as possible.
The Node app never runs on the remote machine, it only runs inside the container, even during development.
Remote machine project location: /home/Tim/Docker/project/*
Container project location: /app/*
Example file EntityIDs.js
:
-- Remote machine: /home/Tim/Docker/project/modules/data/EntityIDs.js
-- Container: /app/modules/data/EntityIDs.js
I tried setting the baseUrl
in jsconfig.json
to "."
, but that results in an auto import of modules/data/EntityIDs.js
, which won't work. It needs to be /app/modules/data/EntityIDs.js
. Setting baseUrl
to /app/
resulted in an auto import of ../home/Tim/Docker/project/modules/data/EntityIDs.js
, so that's even worse.
I searched all over, and I can't imagine I'm the only one ever to run into this problem, but my search results suggest otherwise. Either I'm all alone with my problem (unlikely), or I just really don't know what to search for (a lot more likely)
So, TL;DR: How can I make sure that an automatic import uses the absolute path from inside the container it will be running in?