Remix Vite项目中路径别名无法生效的问题求助
Remix Vite项目中路径别名无法生效的问题求助
各位大佬好,我碰到个头疼的问题:我在tsconfig.json里配置了路径别名,但Remix就是识别不了😭
先给大家看看我的项目结构:
root └app └routes └_index.tsx └components └success.tsx
我的tsconfig.json配置(内容有部分截断)是这样的:
{ "include": [ "remix.env.d.ts", "**/*.ts", "**/*.tsx", "**/.server/**/*.ts", "**/.server/**/*.tsx", "**/.client/**/*.ts", "**/.client/**/*.tsx" ], "compilerOptions": { "lib": ["DOM", "DOM.Iterable", "ES2022"], "types": ["@remix-run/node", "vite/client"], "isolatedModules": true, "esModuleInterop": true, "jsx": "react-jsx", "module": "ESNext", "moduleResolution": "Bundler", "resolveJsonModule": true, "target": "ES2022", // 这里是我配置别名的相关内容,比如baseUrl和paths,但原内容未完整显示 ... } }
我本来想用别名来导入success.tsx组件,比如类似import Success from '~/components/success'这种写法,但Remix一直报错说找不到模块。有没有朋友遇到过类似的情况?麻烦帮我排查下问题出在哪,感激不尽!
备注:内容来源于stack exchange,提问作者melontart
相关产品推荐
相关产品推荐

