ZweiEuro
ZweiEuro
DDeno
Created by ZweiEuro on 3/5/2025 in #help
Test using png mocks
When using imports with *.png files it will crash denos testing system with a warning:
error: Expected a JavaScript or TypeScript module, but identified a Unknown module. Importing these types of modules is currently not supported.
Specifier: file:///home/zweieuro/Documents/uni/2023_SS/WUI/html_UI/vivaci_ui_deno/client/src/player_life.png
error: Expected a JavaScript or TypeScript module, but identified a Unknown module. Importing these types of modules is currently not supported.
Specifier: file:///home/zweieuro/Documents/uni/2023_SS/WUI/html_UI/vivaci_ui_deno/client/src/player_life.png
While I understand the problem, how can i mock away the png and replace it with an identity object or something similar? In jest i would transform it away (https://stackoverflow.com/questions/46898638/importing-images-breaks-jest-test) but i am not sure how deno would handle this
47 replies
DDeno
Created by ZweiEuro on 3/4/2025 in #help
deno test on react template
The deno react +vite starter tempalte doesn't run deno test -A successfully https://github.com/denoland/react-vite-ts-template
1 replies
DDeno
Created by ZweiEuro on 3/4/2025 in #help
Import module from gitlab server
Hi! I want to import an npm module from my private gitlab server, the server and module itself do not require an auth tokenand are publibly accessible. How do i add it to deno ? If possible I want to avoid adding my own server to my npmrc and then importing it. Found this: https://docs.deno.com/runtime/fundamentals/node/#how-to-use-private-registries-with-deno is this really necessary ? because the example only specifies 'private' repos, which does not apply to mine, i don't need a token
14 replies
DDeno
Created by ZweiEuro on 2/28/2025 in #help
Build a React app with a starter template incorrectly setup
Hi! After running the setup for the react template https://docs.deno.com/examples/react_tutorial/ there are some errors that VSCode reports. Mainly that main_test.ts for the server can't find packages specified in:
import { afterAll, beforeAll, describe, it } from "jsr:@std/testing/bdd";
import { expect } from "jsr:@std/expect";
import { afterAll, beforeAll, describe, it } from "jsr:@std/testing/bdd";
import { expect } from "jsr:@std/expect";
which is weird since this is the started template. Is this an error of my setup or a problem of deno ?
1 replies
DDeno
Created by ZweiEuro on 11/19/2024 in #help
Intellisense not working for typescript react.
I ran this to create a new Vite React project: What I did:
deno run -A npm:create-vite@latest --template react-ts
deno install
deno task dev
deno run -A npm:create-vite@latest --template react-ts
deno install
deno task dev
But the type sensing was wrong, there also was no deno.json so i created one:
{
"imports": {
"react": "npm:react@^18.3.1",
"react-dom": "npm:react-dom@^18.3.1"
},
"compilerOptions": {
"lib": [
"dom"
],
"jsx": "react-jsx",
"jsxImportSource": "react",
"types": [
"npm:@types/react",
"npm:@types/react-dom"
]
}}
{
"imports": {
"react": "npm:react@^18.3.1",
"react-dom": "npm:react-dom@^18.3.1"
},
"compilerOptions": {
"lib": [
"dom"
],
"jsx": "react-jsx",
"jsxImportSource": "react",
"types": [
"npm:@types/react",
"npm:@types/react-dom"
]
}}
But the type sensing is still wrong, for very simple code like const [count, setCount] = useState<number>(0); VsCode does not detect count or setCount to be of type number, and it complains that useState has no type argument.
7 replies
DDeno
Created by ZweiEuro on 11/18/2024 in #help
Start a new Vite React project
Hi! Should https://docs.deno.com/runtime/tutorials/how_to_with_npm/react/ work out of the box? I am trying to get it to run with vscode but even if it runs there are a lot of small problems with it out of the box: - svgs are not recognized as valid resources - the react UMD is missing so everything is recognized as an error - doesn't generate a deno.json for me at all - seems in general that a lot of types and intellisense are setup incorrectly ? I have no other plugin active other than dino What I did:
deno run -A npm:create-vite@latest --template react-ts
deno install
deno task dev
deno run -A npm:create-vite@latest --template react-ts
deno install
deno task dev
1 replies