-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Move JS packages away from codebase #1
Comments
Hey @michaelbaudino ! Nice to see in the cyber space 😸 Can you help a poor backend dev lost in the yarn / webpack world? I am trying to run with
And it does not find any previously packages installed with
It sounds like |
FYI, I think I solved this problem using symlinks. |
Hi @jmgarnier 👋 Sorry for the delay, I'm currently on a paternity leave 👶 🍼 Symlinks sound like a smart solution to this, I didn't even think of trying it, tbh. You did something like I'm glad you sorted it out, anyway 💯 |
Hey Michael! Congrats 😄 🍾 👶 :) Yes, indeed:
|
On a related sidenote: Due to bad performance on many systems with a non-native filesystem layer (macOS, Windows), mounting node_modules outside the project path is a great idea. version: "3.7"
services:
app: &app
build:
context: .
dockerfile: Dockerfile
target: build
volumes:
- bundle-cache:/bundle-cache
- node-modules-cache:/app/node_modules
- type: bind
source: ./
target: /app
volume:
nocopy: true
consistency: delegated
volumes:
bundle-cache:
node-modules-cache: This allows for node_modules to be cached, but not synchronized to the host (it's not required, anyways. node_modules should be idempotent and the yarn.lock and package-lock.json make sure you have repeatable results, anyways. With such a setup (note the delegated consistency option), you don't need additional vodoo tools (rsync, etc.) for more performant file syncs between host and guests. |
Thanks for the feedback @Shigawire 🙏 Yes, using a volume to store I've not been using MacOS for years, but I see that mount performance issues are still a work in progress 🤔 I was using docker-sync but as you said: it's another (voodoo 😅) tool to add to your stack. But you are right: using |
Thanks for the quick reply @michaelbaudino! Didn't expect this, on such an old issue. I just realized you're suggesting mounting But yes, Docker's fs performance on macOS is still a big deal. Also Docker networking is still super limited for more complex scenarios, which is particularly bad for running multiple apps in parallel that want to bind to the same port (https://docs.docker.com/docker-for-mac/networking/#known-limitations-use-cases-and-workarounds). Btw. I also like your Dotfile-approach! Very cool, solving the real pains of developing inside containers. |
The JS packages should be stored in
/node_modules
(like Ruby gems are stored in/bundle
) rather than in the codebasenode_modules
sub-directory.This would avoid ignoring
node_modules
indocker-sync.yml
and wouldn't pollute the host filesystem.We need to tell Yarn to use
/node_modules
as modules folder for every Yarn command (as suggested in this issue). The following configuration line in.yarnrc
is supposed to do exactly that:Unfortunately, not all Yarn commands seem to honour this configuration and it seems to break the
.bin
folder, it sometimes wipes outnode_modules
completely, ...This issue is kept open in order to follow progress on this matter.
When all those issues have been worked around, we may be able to improve and merge the code in the use-absolute-node_modules-folder branch 🤷♂️
The text was updated successfully, but these errors were encountered: