报错如下:
tsconfig.json配置如下:
tsconfig.app.json需要添加一下配置:
"compilerOptions": { "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src"], "exclude": ["node_modules"], "types": ["node"], "paths": { "@/*": ["src/*"], "stores/*": ["src/stores/*"] } }
vite.config.ts配置如下:
resolve: { alias: { '@': path.resolve(__dirname, './src'), 'stores': path.resolve(__dirname, './src/stores'), } }
需要注意的是:vite.config.ts里面每加一个alias,ts.config里面也得加下
标签:src,resolve,stores,ts,alias,typescript,报错,vite From: https://www.cnblogs.com/yseraaa/p/18527948