Deno

D

Deno

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

Join

[Svelte + Vite + Deno 2.0] Svelte and Vite configuration without a package.json

Hello, i am trying to setup a deno 2.0 simple project that has svelte (not svelte kit) and vite on it as well as rely only on a deno.json file for the dependency installation instead of package.json. My current situation is, i have the project setup with the needed dependencies inside of the deno.json and i have the vite.config.ts, svelte.config.ts and tsconfig.json setup as well. Initially the project works just fine when you run it with just vite, but when i try to add a Svelte component like the usual App.svelte i am being hit with this vite error Pre-transform error: Failed to resolve import "svelte/internal/disclose-version" from "src/App.svelte". Does the file exist?. I am pretty sure that the root cause for this is the fact that the modules with deno 2.0 and deno.json are being installed in a diffrent directory for me on Linux that's .cache/deno, the file mentioned in the vite error is present in the svelte module folder that is in .cache/deno/npm/registry.npmjs.org/svelte/5.15.0/src/internal/. I am not sure what i am supposed to do to make vite look into that path to fetch the file it needs. Thanks in advance for any responses...

Can symbol documentation be detected when re-exported from top level default export?

I am working on a promise util library here: https://jsr.io/@tyler/duckhawk@0.1.0 I have documented my first util with jsdoc, but re-exporting this symbol from a top level default export seems to break the jsr auto-doc detection. Update: It seems like exporting as a single default object results in the wrong type output too, which seems related. The type of default is {}. ...

Wasm In Fresh

What are some great resources to get started with using WASM in Fresh?

Inlay hints for Deno LSP in nvim?

I am using LazyVim and i got used to inlay type hints in my code. I recently started to use Deno and my only problem is that in Deno language pack for lsp there are no Inlay Hints. Or am I missing something? Did anyone tried to configure it?

_layouts are static / Server Side? How "any state set by middleware is available via props.state"

Hi all. I am trying to make a dynamic layout that changes based on the client window width (window.innerWidth) so i can swap the layout when the screen is resized or is too small. I wasn't able to use a layout because it seems like layouts are server side and don't count as Islands so: - I cant useEffect - using a Singal doesnt update _layout and re-render on signal updates it just gets the signal once on load... ...

Could not resolve "node:url"

Hey, I am trying to build deno with esbuild + @luca/esbuild-deno-loader. I am encountering such errors, most of the things I was able to fix, but this one is a dependency in a library which I need. Is there any way to work around it? ``` ✘ [ERROR] Could not resolve "node:url"...

Creating Deno.json wrecks Next.js project

I am trying to create a Next.js project with Deno, Shadcn & Tailwind. Things initially seem fine until I realise that I need to create a Deno.json file to get Object.prototype.__proto__ to work. However as soon as I create a Deno.js file, I am bombarded with numerous errors that I wouldn't (and shouldn't) be getting otherwise - even within Shadcn components. ...
No description

Checking less - when it comes to deploying..

How to customise demo deploy, e.g. skip checking for typos, formatting etc as I just seem to be going in endless loops trying to get all these checks happy

Issue with Adding Object to S3 from Deno Deploy (Works Locally)

Hello everyone, I'm facing an issue with uploading objects to my S3 server using the AWS SDK in Deno Deploy. The same code works perfectly fine when running on my local system, but fails after being deployed to Deno Deploy. Additional Information:...

deno_ast 1:1 token location mapping

Is there a way to have transpiled token locations correspond to where they're located in the original source? For example, if you have ```ts let x: string = "hello world";...

"Publishing" deno packages to a web accessible S3 and resolve deno.json workspace members?

Heya, I would like to publish some packages internally in our company by basically uploading them to a web accessible S3 bucket. For example, if I had: - @mycompany/foo, it might live at s3.internal.mycompany.com/pkgs/mycompany/foo and be located in the packages/foo folder - @mycompany-cli/bar it might live at s3.internal.mycompany.com/pkgs/mycompany-cli/bar and be located in the scripts/bar folder...

Cannot find module 'npm:react-router-dom' or its corresponding type declarations.

This is the error message the Typescript LSP gives me when I use the line import { Outlet } from "npm:react-router-dom". What is the proper way to get rid of it?

How to set reuseaddr in `Deno.serve`?

How to set sockopt reuseaddr and reuseport with Deno.serve

Writing and sharing libraries locally

I have been working the last days with deno. I wrote a library that I wanted to use in other local deno project. I found no way whatsoever to be able to use the library directly. The library depends on npm packages. The only feasible way was to port it to npm using dnt. Good so far, if I import the generated npm package in another npm project all works fine. However, if I install such package in the deno project, no types are solved. And yes, I configured the package.json exports with types definitions, nothing worked and in VSCode I kept having imports from that package as "any". Finally I tried referencing the files from the library with filesystem paths but this lead to other problems, so is a no go. There should be a simple support for developing local libraries, hanlding deps from libs in importer projects out of the box, just like a maven project. Anyone has achieved a similar flow? Unfortunately this complications have led to stick with node+npm, and it is a shame because I was enjoying deno. PD: VSCode plugin needs a lot of work still....

HMR compile error

Hello, I get a "HMR Failed to reload module file:////app/pages/index.tsx: compile error." when using unstable-hmr and editing index.tsx. I want to know why, but there is no additional information provided....

deno upgrade lts <- still no version available?

I was happy to see that the LTS branch now is supposed to be available. When trying to upgrade to it, I get a message that it is not available. I'm guessing this is a placeholder message that should have gone away but some flag somewhere might have to be flipped to enable this feature? ```shell >deno upgrade lts Current Deno version: v2.0.6 Looking up long term support version...

Unable to target browser and deno with unstable features in typescript `compilerOptions.lib`

Hi. I followed the guide from docs to include libs for dom api and deno unstable features in the same environment. But it doesn't work for me. I added this to deno.json: ```json { "unstable": ["webgpu"],...

Unable to request adapter for webgpu on WSL2

Hi. I would like to experiment with webgpu on wsl, but when I tried running my code with deno, I couldn't request adapter.
console.log(await navigator.gpu.requestAdapter()) // returns null on WSL2
console.log(await navigator.gpu.requestAdapter()) // returns null on WSL2
...

Issues with importing from npm - should I switch to esm.sh?

Is importing from esm.sh recommended over npm? Recently I've been having a lot of issues with imports from npm inside Jupyter. For example: ``` import * as crypto from "node:crypto"; import { DynamoDB } from "npm:@aws-sdk/client-dynamodb@3.714.0";...