[Vuejs]-Are VS Code Dev Container typically slow when developing with Vuejs

0👍

Yes it is to be expected 😉 you can checkout the following link to speed up some things.

Basically, in case you are not using docker-compose this is what you have to do (copied from the Microsoft Website)

Follow these steps:

Use the workspaceMount property in devcontainer.json to tell VS Code where to bind your source code. Then use the mounts property (VS Code 1.41+) to mount the node_modules sub-folder into a named local volume instead.

"mounts": [
    "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
]
Note: You may use ${localWorkspaceFolderBasename}, ${devcontainerId}, or a hardcoded name in the source.

Since this repository runs VS Code as the non-root "node" user, we need to add a postCreateCommand to be sure the user can access the folder.

"remoteUser": "node",
"mounts": [
    "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
],
"postCreateCommand": "sudo chown node node_modules"
This second step is not required if you will be running in the container as root.

If you've already built the container and connected to it, run Dev Containers: Rebuild Container from the Command Palette (F1) to pick up the change. Otherwise run Dev Containers: Open Folder in Container... to connect to the container.

Two notes on this approach:

If you delete the node_modules folder in the container, it may lose the connection to the volume. Delete the contents of the node_modules folder instead when needed (rm -rf node_modules/* node_modules/.*).

You'll find that an empty node_modules folder gets created locally with this method. This is because the volume mount point in the container is inside the local filesystem bind mount. This is expected and harmless.

Leave a comment