Deno

D

Deno

Chat about Deno, a modern runtime for JavaScript and TypeScript.

Join

Memory leak when conditionally stubbing fetch

I'm having an issue during a test using @std/testing/mock where I want to stub fetch for only a specific URL (an OAuth token exchange endpoint) receiving a mocked response in this case. For all other fetches, I want the fetch to behave normally. Everything seems to be functional however the test is failing due to fetchCancelHandles not being cleared up but I really can't see how this could happen as all requests made have their bodies consumed. I wondered if any smarter people have experienced this before or have any answers as to why this specific behaviour is arising. Error: ```...
No description

Why isn't the API_PORT variable being loaded? Is there something I'm missing?

I'm trying to load an environment variable API_PORT using Deno and the @std/dotenv module, but it’s not being loaded correctly. The variable is undefined when I try to access it with Deno.env.get('API_PORT'). Here’s the code: ``` import { Hono } from '@hono/hono'; import { load } from "@std/dotenv"...

React + Vite (without `node_modules`)

I'm trying to configure a Deno-first React + Vite project without the node_modules dir. I thought this might be doable thanks to the new deno-vite-plugin from the Deno team. Unfortunately I encounter an issue upon running the served/built application (see issue here). Wondering if anyone has ideas on how to resolve this issue? If so, Deno+Vite+React projects will be so much cleaner!

How do I supress deno(resolver-error)

I want to supress the errors in this file. These packages are not installed but that's okay becuase I'm not using these files within this project.
No description

deno check does not accept noImplicitReturns

hello. i have the following config inside deno.json: ```json { "compilerOptions": {...

Config deno.json for Svelte formatting

In Supported file types, I see that Svelte need config option. Here is my deno.json, is it true? ```json { "lint": {...

how to add a code generation hook pre-build in fresh

I have a bootstrapped fresh project. when running in dev mode with deno run --watch ... dev.ts, it uses deno's native watch feature and restarts the server when a file changes. in my needs, when a specific file types.ts I need to run a different generation script, something like deno ./generate.ts ./libs/types.ts ./libs/types.gen.ts...

import_map.json not working

I am currently trying to checkout an project in Deno 2.0.0 and when I try to run a task I get a warning and error:
Warning the configuration file "cwd/deno.json" contains an entry for "importMap" that is being ignored.
error: Relative import path "@std/cli/parse-args" not prefixed with / or ./ or ../ and not in import map from "project/config/build/index.ts"
Warning the configuration file "cwd/deno.json" contains an entry for "importMap" that is being ignored.
error: Relative import path "@std/cli/parse-args" not prefixed with / or ./ or ../ and not in import map from "project/config/build/index.ts"
...

Can Deno Jupyter output images like jpegs?

Docs aren't super clear about this. I naively thought this would work: ``` const img = await Deno.readFile("./my-image.jpg"); ...

Nestjs project hasn't been support for now?

I got the error message below when deploy my nestjs application, is nestjs hasn't been support for now? Or there is a way to deploy nestjs project to Deno deploy for now? Or this is a problem about a module (not nestjs) which can't run on Deno Deploy? ``` error: The deployment failed: UNCAUGHT_EXCEPTION Error: This API is not supported in this environment...

[bug ✨] Cannot find module (in vs code)

Describe the bug I recently created a deno jsr package for exciting purposes. this is my package called @devloeprsabbir/hello Expected behavior as I set a screenshot.. I'm getting errors on VS code but the code works perfectly when I run my code with deno main.ts also I'm not getting any check errors....

Failed to resolve import "react/jsx-dev-runtime" from "src/main.tsx"

I'm trying to understand esm.sh. I started with the deno-react-ts template, initialized the esm.sh tasks, and added react / react-dom to my imports map - deno.json. I'm getting this error Failed to resolve import "react/jsx-dev-runtime" from "src/main.tsx". I would expect this to be resolved from the react/ import map. Any suggestions?...

document is not defined error while testing preact hooks

Currently I'm developing a preact hooks library. When I try to run a simple test using deno test, it throws me the next error:
error: ReferenceError: document is not defined
error: ReferenceError: document is not defined
...

How to remove yellow underlines in deno.lock file

i just installed and run a main.ts file. After that, i got a bunch of codes with yellow underlined format in deno lock file. it says "Incorrect type. Expected "string".
No description

Transpile TS to JS

My app is serving a rendered ejs template as html. Inside my html there is
<script type="module" src="test.ts"></script>
<script type="module" src="test.ts"></script>
how does my app now return the typescript as javascript? ...

Cannot run existing Nextjs App

Im trying to run dev on my existing nextjs app, but cant run task dev. giving error on next config itself...
No description

Remove development dependencies in CI

Hey! I am trying to deploy an app I migrated to Deno and am currently working on the Dockerfile. Previously, I would run npm i and then build the app before removing the node_modules folder and installing only the prod dependencies. I don't think deno install has a --ci option. How can I install only the prod dependencies and not dev with Deno? Or is this not necessary with Deno? Current WIP Dockerfile (please let me know if you spot anything I can improve!):...

Could not build NextJS project

Hello , after the new releashe I tried to use deno for one of my nextjs projects and failed to build it. Using "deno tansk build" gave me a "Failed to compile. Error: The file or directory is not a reparse point. (os error 4390): readlink" It works fine in dev mode though...

Any docs for profiling deno in vs code?

We need to check the performance of our code written in deno so for that we need to have support for profiling in vs code? any solution? here is one ref https://code.visualstudio.com/docs/nodejs/profiling...

JSR publish: source .ts or transpiled .js w/sourcemaps?

When publishing to JSR, should I be publishing the source .ts, or do I still need to transpile to .js, include sourcemaps, specify main, module, typings in my manifest, all that jazz?
Next