D
Deno

help

External dependencies with npm specifier in combination with vite does not work.

OOmegaPirat8/17/2023
Hi, I am new to Deno and want to build an app with deno, vite and react. Unfortunately the dependencies are not resolved correctly. It says: The following dependencies are imported but could not be resolved: npm:react (imported by.....) npm:react-dom/client (imported by ...) npm:styled-components (imported by...) npm:vite@^4.3.9 (imported by ...) npm:@vitejs/plugin-react@^4.0.0 I added my vite.config.mts and my deps.ts to the attachment. I start the app with the command deno run -A npm:vite My deno version is 1.36.1 Do you need any further information? I am pretty desperated and thanks in advance ๐Ÿ™‚
Ssean8/17/2023
GitHub
examples/with-react at main ยท denoland/examples
A simple todo app using Deno and React. Contribute to denoland/examples development by creating an account on GitHub.
OOmegaPirat8/17/2023
Yes I came across of it. Unfortunately they don't make use of the npm prefix outside of the vite config file. For some reason it recognizes the imports if I place the vite dependencies directly into the vite config file instead of the deps.ts. For what are those additional react imports in the vite config good for? Is this important? https://github.com/denoland/examples/blob/main/with-react/vite.config.mjs
GitHub
examples/with-react/vite.config.mjs at main ยท denoland/examples
A simple todo app using Deno and React. Contribute to denoland/examples development by creating an account on GitHub.
Ssean8/17/2023
import "npm:react@^18.2";
import "npm:react-dom/client@^18.2";
import "npm:react-router-dom@^6.4";
import "npm:react@^18.2";
import "npm:react-dom/client@^18.2";
import "npm:react-router-dom@^6.4";
These?
OOmegaPirat8/17/2023
yes i just cloned the demo project and tried to start it. It fails with the message Task dev deno run -A --unstable --node-modules-dir npm:vite failed to load config from C:\Users\bsiem\WebstormProjects\examples\with-react\vite.config.mjs error when starting dev server: TypeError: Invalid package specifier 'npm:react-dom/client@^18.2'. Did you mean to write 'npm:react-dom@^18.2/client'?
Ssean8/17/2023
I honestly don't know for sure Yup, you aren't the only one There are other people having your same issue apparently Do you have a node project that you need to convert to Deno? Or is it a brand new thing?
Ssean8/17/2023
Because if I were you I wouldn't risk going crazy and just go with the recommended alternatives: https://deno.land/manual@v1.36.1/basics/react
Deno
Using React with Deno | Manual | Deno
To use React with Deno, we recommend using one of the third-party frameworks below.
OOmegaPirat8/17/2023
It is just a small private project (a differential equation solution plotter to solve and visualize physics problems): It started with node and now I want to transform it to deno. So you mean I should try a react based framework like fresh?
Ssean8/17/2023
Probably would be the smoothest option In the past I used to waste way too much time fixing problems like this, it's just not worth it Just build your project xD
OOmegaPirat8/17/2023
now i run into another issue. I setup fresh and if I want to import import {BarChart} from "https://deno.land/x/d3nodata@v0.1.3.1/charts.ts" and use it like <BarChart datasets={plotData.datasets}/> It says TypeError: Cannot read properties of undefined (reading '__H') at a (https://esm.sh/stable/preact@10.11.0/denonext/hooks.js:2:208) at j (https://esm.sh/stable/preact@10.11.0/denonext/hooks.js:2:910) at Object.BarChart (https://deno.land/x/d3nodata@v0.1.3.1/chart-comps/BarChart.tsx:379:3) i scaffold a basic fresh project and it runs normally but as soon as i want to use something from d3no I run into this issue

Looking for more? Join the community!

Recommended Posts
Question about for loopsWhy does the following code log numbers from 0 to 9 instead of 1 to 9? `i` is assigned as zero in thDockerfile saaskit deploymentI created an entry in `deno.json` starting a script named `db:init` to initialize my KV DB with an uDeno TypesWhat is the Deno.ServeHandler type? ```No overload matches this call. Overload 1 of 3, '(handler: I use Deno KV for my application, and I'm planning to use Deno Deploy. Can I allow deploy to use...I use Deno KV for my application, and I'm planning to use Deno Deploy. Can I allow deploy to use KVbad resource id with node:crypto```ts function test() { const key = randomBytes(32); const iv = randomBytes(16); const cipher Close a Deno.serve() connection?Is it possible to close a Deno.serve() connection?Relative import path "preact" not prefixed with / or ./ or ../ at https://deno.land/x/fresh@1.4.Please help. ``` deno 1.36.1 (release, aarch64-apple-darwin) v8 11.6.189.12 typescript 5.1.6 ```Problems with Deno KV```ts import InputLoop from "https://deno.land/x/input@2.0.3/index.ts"; const kv = await Deno.openKFile differs only by case errorI'm getting a strange error from TypeScript. For some reason it thinks the case of my file name is Possible to have multiple http servers listening to different ports in the same module?I'm porting a service mesh platform we wrote for NodeJS over to Deno and it is based on the idea of How to have private state in embedded deno_core JsRuntime?I need to either keep a reference in rust to an object I then `delete globalThis.__context`, but I cIssues getting local environment running in VSCode and Visual Studio 2022I'm a windows user trying to contribute on an github issue, but I've run into a few blockers. Using Relative import path "ioredis" not prefixed with / or ./ or ../```ts // main.ts import Redis from "ioredis"; ``` ```json // deno.json { "imports": { "ioredisPixi.js breaks DenoI'm trying to import Pixi in a Fresh island: ``` import { Sprite, Stage } from "npm:@pixi/react@7.1Confused by deno vendor-related behaviorsI created a main.ts containing this code: ``` import * as thrift from "npm:thrift"; let connection =How to release node:zlib resourcesI have some testcases which use the `node:zlib` polyfill and I'm having a bit of trouble getting theDeno Repl ProgrammaticallyPython has a really nice not-well-known tool for creating a repl at any point in the code (kinda likDeno for SASS dependencies?I'm trying to understand how I would migrate from Jekyll and NPM to Lume and Deno. Specifically, I uHow can I send a number across a Deno.TcpConn as stream of bytes?I need to send a number across a Deno.TcpConn as 4 bytes, so it can be read by a server as an int32.Migrating `Deno.run` to `Deno.command` with `readlines`I had the following: ```ts browserProcess = Deno.run({ cmd: buildArgs, // eg chrome exe path, th