Various errors when opening a React + Vite template project - user error or bug? #1321
-
Hi! I'm posting this as a discussion first, because I'm not sure whether it's a bug or not (and whether I should file an issue), or whether it's simply a user error. I need a second opinion from someone more experienced than me, as I am literally just starting out with Deno/Vite/etc. Environment
StepsI tried setting up the official React + Vite TS template, to a decent success, but with quite a few issues along the way. Granted, I managed to get the default web application served, so that'd lead me to believe this is more of a bug in the extension, than an error on my part. My steps to reproduce might be overly complicated too, I got there after failing a couple times, breaking my lock file (?), and starting over.
The project gets properly served on the default localhost IP/port. However, despite it running, I still get quite a few errors in VS Code. ErrorsRunning
When I open the Finally, every time I open/switch to a TS file, the Deno Language Server output prints "Failed to resolve npm:[email protected] to a file URL.". I don't know the exact process how the names are resolved, but I certainly have these packages in the Previously, before coming back to the project a few hours later, I had more errors in the editor, but they disappeared since (can't tell you why) so I can't add those here, sadly. I tried both Is this maybe a bug in the VS Code extension, given that the project runs, or is there an issue with my steps? Thanks everyone in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The config file at https://github.com/denoland/react-vite-ts-template/blob/main/deno.json should be amended in the following ways:
So it's a bug with the template. After that, remove |
Beta Was this translation helpful? Give feedback.
The config file at https://github.com/denoland/react-vite-ts-template/blob/main/deno.json should be amended in the following ways:
"nodeModulesDir": "auto"
, allowing you to remove--node-modules-dir=auto
from thetasks
.compilerOptions.types
.So it's a bug with the template.
After that, remove
deno.lock
andnode_modules
just in case and thendeno check
should work. You might have to restart the language server after populatingnode_modules
to fix intellisense.