zimboZ
Denoβ€’2y ago
zimbo

caching known dependencies on devcontainer startup

πŸ‘‹ after setting up an ubuntu devcontainer with deno and the vscode extension installed, is it possible to cache the dependencies in
import_map.json
on startup?

i've tried adding deno cache as a post* command and in Dockerfile but find that nothing happens as post* steps and Dockerfile errors with an unfound file or doesn't work from the correct directory:

{
    "customizations": {
        "vscode": {
            "extensions": ["denoland.vscode-deno"]
        }
    },
    "postAttachCommand": "deno cache import_map.json"
}

which outputs:
Running the postAttachCommand from devcontainer.json...

[3185 ms] Start: Run in container: /bin/sh -c deno cache import_map.json
Done. Press any key to close the terminal.


when first loading a file that imports modules, an "uncached remote URL" error appears. this is fixed on the first save (which is really nice), but i'd prefer to have known dependencies cached already if possible.

here's some reference i found:
- https://docs.deno.com/runtime/manual/references/vscode_deno/#caching-remote-modules
- https://docs.deno.com/runtime/manual/references/vscode_deno/#using-a-development-container
Was this page helpful?