Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

只要是@开头的路径都识别不了,vite+typescript,Could not find a declaration file for module "@/xxx",哪位大神知道tsconfig.js该如何配置? #13089

Unanswered
tiktwink asked this question in Help/Questions
Discussion options

image
image
image

哪位大神知道tsconfig.js该如何配置?

You must be logged in to vote

Replies: 2 comments

Comment options

vite.config.ts也要设置

import path from 'node:path'
export default defineConfig(({ command, mode }) => {
 const srcPath = path.resolve(__dirname, 'src')
 return {
 resolve: {
 alias: [
 // @ -> src
 { find: '@', replacement: srcPath },
 // less 中 ~
 { find: /^~/, replacement: '' }
 ]
 },
 }
})

当然,偶尔也会出现VSCode、或者node_modules抽风的情况,我今天就遇到了,就需要删掉node_modules重新安装

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /