只要是@开头的路径都识别不了,vite+typescript,Could not find a declaration file for module "@/xxx",哪位大神知道tsconfig.js该如何配置? #13089
Unanswered
tiktwink
asked this question in
Help/Questions
-
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments
-
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
重新安装
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
-
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment