reactjs - page/Activity/ActivityTable ✖ 找不到包“page/Activity/ActivityTable”。你安装了吗?当我使用雪包开发时
问题描述
也许这是一个tsconfig
问题,但我不知道什么是正确的。我使用模板app-template-react-typescript
,我发现当我使用src/page
它时它可以工作。
这是我的 tsconfig
{
"include": ["src", "types"],
"exclude": ["node_modules"],
"extends": "@snowpack/app-scripts-react/tsconfig.base.json",
"compilerOptions": {
// You can't currently define paths in your 'extends' config,
// so we have to set 'baseUrl' & 'paths' here.
// Don't change these unless you know what you're doing.
// See: https://github.com/microsoft/TypeScript/issues/25430
"experimentalDecorators": true,
"baseUrl": "./",
"paths": {
"stylesheet/*": ["src/asset/stylesheet/*"],
"image/*": ["src/asset/image/*"],
"shared/*": ["src/shared/*"],
"layout/*": ["src/layout/*"],
"component/*": ["src/component/*"],
"page/*": ["src/page/*"],
"utils/*": ["src/utils/*"],
"constant/*": ["src/constant/*"],
"store/*": ["src/store/*"],
"src/*":["src/*"]
}
// Feel free to add/edit new config options below:
// ...
}
}
解决方案
已经得到 snowpack 团队的回答,他们说:我们目前不支持 TSConfig 路径,但我们有一个 PR 要添加:pikapkg/snowpack#432 在那之前,您需要通过“src/page/Account”导入让 Snowpack 正确识别它
所以我会关闭这个问题并暂时使用'src/page/Account'来解决我的问题
推荐阅读
- bootstrap-4 - 如何在引导显示中显示“在具有多行标题和标签的两列中
- asp.net-mvc - Fancytree 在 MVC 4 中无法正确加载
- tensorflow2.0 - TensorFlow Lite 全整数量化在 TF 2 中失败
- laravel - 尝试引用关系表中的类型时找不到列
- postgresql - 带有子查询的 SQL 条件返回操作数错误
- swift - 在 SwiftUI 上的 Firebase 中使用 updateData 函数时出错
- git - 有没有办法让 git add --patch 跳过所有单行更改?
- android - Android 应用程序与 Play 商店中的新设备不兼容
- android - UI Automator - 获取 XY 坐标的背景颜色
- javascript - 检查输入值是否为回文的函数总是返回 true