bartlomieju / vite-deno-example

Example of using Vite with Deno

Home Page:https://vite-deno-example.deno.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Relative import path "vue" not prefixed with / or ./ or ../

sistematico opened this issue · comments

VSCode is showing error on import. The app is running fine BTW.

image

Fresh install.
Any help is welcome.

I have this problem as well. What's the go for deno to type check these properly? Is it that vite needs to be taught about npm specifiers and currently it's not, so we're using a hack by importing all dependencies in the deno entrypoint instead, thus causing node_modules to be populated, and then finally vite can pick up the standard dependencies...?

Any suggestions to get type checking working ATM?

Ah interesting, using import maps does work for me. Thanks! I suppose that's one solution for now (ignoring the auto complete issue).

Ah interesting, using import maps does work for me. Thanks! I suppose that's one solution for now (ignoring the auto complete issue).

You can share your import_map.json?

{
  "imports": {
    "@faze/editor-backend": "./packages/editor-backend/mod.ts",
    "@faze/editor-cli": "./packages/editor-cli/mod.ts",
    "@faze/editor-frontend": "./packages/editor-frontend/mod.ts",
    "@react-three/drei": "npm:@react-three/drei@9.45.0",
    "@react-three/fiber": "npm:@react-three/fiber@8.9.1",
    "react-dom": "npm:react-dom@18.2.0",
    "react-router-dom": "npm:react-router-dom@6.4.4",
    "react": "npm:react@18.2.0",
    "three": "npm:three@0.144.0",
    "three-stdlib": "npm:three-stdlib@2.20.4"
  }
}

With deno json

{
  "importMap": "./import_map.json",
  "tasks": {
    "editor": "deno run --allow-run packages/editor-cli/mod.ts"
  },
  "compilerOptions": {
    "jsx": "react-jsx",
    "lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"],
    "types": ["vite/client", "./types/vite.d.ts"]
  }
}

Thank you.

Unfortunately it is currently not supported in Deno extension to type check the code that has no npm: prefix or is not specified in the import map. We'll be looking into sorting this situation after NYE.