Created
November 10, 2023 18:26
-
-
Save PatrickChoDev/81d36159aca4dc687b8c89983e64da2e to your computer and use it in GitHub Desktop.
PNPM devcontainer multiple project setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Multiple PNPM projects", | |
// recommend using microsoft default image | |
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye", | |
// !!!! MAGIC STARTS HERE!!! | |
"mounts": [ | |
"source=global-pnpm-store,target=${containerWorkspaceFolder}/.pnpm-store,type=volume" | |
], | |
"postCreateCommand": "sudo chown node .pnpm-store" | |
.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage Example
Project 1
.devcontainer/devcontainer.json
:package.json
:src/main.js
:This project seems to use latest
express
from npm.Project 2
.devcontainer/devcontainer.json
:package.json
:after running
pnpm install
on this project you will see...Oh! it seems installed deprecated
express@^3.0.0
library. Let's see on runtime.src/main.js
:This project seems to use
express
version which defined inpackage.json
which is what I expected to see from node with devcontainer!.Let's craft your own one :)
Careful !!
Even it's work I recommend you not to touch
.pnpm-store
after creation. It might break if you delete some files in it. If it necessary or accident happen, you can simply runpnpm install
in every single project that use this docker volume.