Deno

D

Deno

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

Join

`.svelte` file intellisense can't properly resolve imports in a Deno only project

I have a Deno workspace with: - a shared member which in the deno.json has "name": "@scope/shared" - a client member which is Vite+Svelte and only uses Deno (no package.json) everything works and builds perfectly fine however:...

"window" global issues using the p5.js library in a Deno / Fresh project

Hi I'm trying to use the p5.js library to make a little game on my site that uses Deno and Fresh. I tried directly using the p5.min.js download, the p5.js NPM package, and this p5 wrapper that says it's compatible with Deno / TS: https://jsr.io/@kaleidosium/p5-wrapper-ts. All of these result in the same "window is not defined error" coming from p5.js because p5 is trying to use the window global and i'm wondering if there is any way to fix this. I was thinking to try replacing the window calls in the p5 file but it's transpiled into an illegible form of js. It's also strange that the p5-wrapper package says it works with Deno so I'm just wondering if there's something i'm missing here, or another way to use p5 with Deno. Might just try importing with a CDN next or just using Three.js for now. Thanks!...

Resolving Dependencies for Local ESM NPM Packages in Deno

Hi Deno Community, I'm seeking guidance on the best approach for a setup involving a Deno application and a local, unpublished npm package using ESM. I'm having trouble with Deno automatically resolving the npm package's dependencies without explicit declarations in Deno's config file. Here's the project structure: ```text local_module/...

fix library version of a dependency

Putting this to deno.json ```json { "imports": { "gcp-metadata": "npm:gcp-metadata@6.1.0"...

Can Deno compile javascript into a dll?

so it runs when dllmain is called ykyk like a normal dll

Is it a good idea to use Deno edge functions as a websocket server?

For my app I am sending and receiving audio to and from my server. As I want to closer to my users I want to use an edge server but are deno deploy functions designed to handle websockets (being ephemeral servers)?

deno install Omit/exclude dev dependencies from package.json

I have a sveltekit project that I want to convert to using deno 2.0 (currently using 2.1.9). I can run deno build (to pre render my sveltekit app) and cd build && deno index.js works like a charm. However, I also have some api routes that use npm packages. Everything works fine when running locally. But when I build my Docker image, I would like to install only the needed dependencies (those under dependencies). I don’t need the devDependencies, such as lints and types. In npm, I would use --omit=dev (I believe Bun has a similar flag). Is there a way to exclude devDependencies when running deno install ...

error: Relative import path "@std/http/file-server" not prefixed with / or ./ or ../

I'm following this documentation to create a static files server https://docs.deno.com/examples/file_server_tutorial/ There seems to be problem with the first line of the code, which is import { serveDir } from "@std/http/file-server"; ...

Module not found "https://glfw-binaries.deno.dev/3.4.0-patch1/glfw3_darwin.js"

Hey, deno couldn't find the glfw3 lib. ```js import { createWindow,...

Deno TLS

I would like to start both a HTTP and a HTTPS server (for a reverse proxy) and be able to serve dynamically several certificates for virtual hosts that enable TLS support (via a cert + key), there are there methods in the Deno object which are startTls, listenTls, and connectTls, but I'm not sure how can I start a server that listens for HTTP requests, and connects using Tls to the client, I must admit I know less of the TLS than the HTTP protocol, any example on how can I do that?

API server with Postgres on Deno Deploy ConnectionParamsError

Hi everyone, I’ve been following the "API server with Postgres" tutorial (https://docs.deno.com/deploy/tutorials/tutorial-postgres/) and have set everything up successfully. For my project, I decided to go with Supabase. However, when I try to test the setup in the playground, I’m running into an error:
ConnectionParamsError: Missing connection parameters: database at assertRequiredOptions (https://deno.land/x/postgres@v0.19.3/connection/connection_params.ts:250:11)...
No description

I cannot make deno exclude dist/ directory

👋 I'm trying to make deno exclude the dist/ directory from formatting but couldn't. I tried the exclude and fmt.exclude fields in deno.json and tried different values—dist, dist/, dist/*—but nothing worked. Every single time I run deno fmt (in the same directory where my deno.json is), I see that the files in dist/ directory are also formatted. It's not a dealbreaker but being unable to get something so small and simple is quite annoying. Is this a bug or am I doing something wrong? Thanks!...

Writing a script to check which process is locking a file on Windows?

I want to write a TypeScript script which lets me check which process is locking a file on Windows. I would like to run it using Deno. I checked through the packages of the standard library to see what might be relevant, and the fs package stood out, but it doesn't provide any functions that may be relevant. ...

loadEnvFile

Hi. Looking at https://docs.deno.com/api/node/process/~/Process.loadEnvFile It looks like process.loadEnvFile is implemented in deno (using 2.1.9) but it isn't found. What do I not understand?...

Compiled executable fails to run as service

I'm trying to setup a deno script as a windows service. I created a DLL in C and am loading with Deno.dlopen. I can start the service when using deno run service.ts, but it immeadiatly fails to start if compiled with deno compile service.ts and the .exe is added to the service

how to use .ts files (or their compiled .js equivalents) in the browser?

Does Deno have a builtin way to compile ts into js for such purposes, or is there a design pattern that is recommended to make this possible, or am I stuck using webpack? I am playing with the Node crypto lib and I want to use the functions I've written in the browser's socket.io client-side code to encrypt the data that gets sent to the socket.io/deno server-side code....

Fresh defer load

So, I've been having some problems with fresh, but been working it out, kinda. The problem now is fetching. I'm fetching from both the github api and the gitlab api, but I don't want the user to notice it that much, I'll just add a Loading ... message there. The thing, how can I do it with fresh? In other frameworks, I could just return a promise and it would just defer for me, or the usage of some kind of a suspense would do that, but I haven't seen anything on the docs about defer load or returning a promise from the loader. Is there just no conventional way of doing it? Do I need to do it the "old" way (create an api endpoint, return the data, call fetch on an island and pray it works)?...

Workspace - container per app?

Is anyone using workspaces with separate containers for each app, without having to include the entire monorepo in the image? Currently Deno errors out with "Could not find config file for workspace member".

VS Code Deno formatter doesn't read deno.jsonc

I have a deno setup with this config in the root of my project: { "fmt": { "include": ["/*.ts", "/*.tsx"],...

Build and bundle TS into JS

Im starting a pretty muhc new, minimal Ts project that I would like to use Deno to host, and then have a (as much as possible) zero config that bundles all my code (from one entry point) into javascript that can be hosed elsewhere. But, how to do it? seems simple enough but seems like it's very hard to get a "primer" working with zero config. Please help. My other option would obviously be to host on deno deploy, but it's so un-intuitive how to host there. #deploy #bundle #build...