ryann
ryann3mo ago

imports or deps.ts

Hi! I'm trying to create my first Deno app. I'm trying to dockerize it and the Dockerfile has this line:
# Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified).
# Ideally cache deps.ts will download and compile _all_ external files used in main.ts.
COPY deps.ts .
RUN deno install --entrypoint deps.ts
# Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified).
# Ideally cache deps.ts will download and compile _all_ external files used in main.ts.
COPY deps.ts .
RUN deno install --entrypoint deps.ts
But all my imports are in deno.json
{
"tasks": {
"dev": "docker build -t app . && docker run -it -p 1993:1993 app"
},
"imports": {
"@std/assert": "jsr:@std/assert@^1.0.7"
}
}
{
"tasks": {
"dev": "docker build -t app . && docker run -it -p 1993:1993 app"
},
"imports": {
"@std/assert": "jsr:@std/assert@^1.0.7"
}
}
So I was wondering, is deps.ts an old way of importing things? Which one is the preferred way?
1 Reply
artpods56
artpods563mo ago
Hey, from what i know the deps.ts is the old way of doing things and the imports sections in the deno.json is the place where you should list the dependecies.

Did you find this page helpful?