typescript - “错误:找不到模块'@modules/user'”,用于打字稿项目下的多个 tsconfig 文件
问题描述
如何在 typescript 中为不同的 eslintrc 和 tsconfig 设置 eslint 我有以下用于编译 eslint 的结构和测试命令。每当我运行tsc
时,它都会使用被测路径别名从文件中生成所有错误,但从编辑器(webstorm/vscode)路径中生成的所有错误都是正确的,没有错误。我该如何配置,所以当我运行 compilt 命令时,它可以读取不同的 tsconfig.json 而不仅仅是从root/tsconfig.json
.
- root
|_tsconfig.json
|_.eslintrc.json
|_test
|_tsconfig.json
|_.eslintrc.json
|_abc
# root/tsconfig.json
{
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"@uc/eslint-config-react",
"prettier",
"prettier/react",
"prettier/@typescript-eslint"
],
"plugins": ["react-hooks", "@typescript-eslint"],
"parser": "@typescript-eslint/parser",
}
# root/test/tsconfig.json
{
"compilerOptions": {
"strict": true,
"target": "es6",
"module": "commonjs",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"types": ["cypress", "chai"],
"baseUrl": ".",
"paths": {
"@abc/*": ["./abc/*"],
}
}
}
解决方案
推荐阅读
- android - 为什么在 Android Studio 中构建 kotlin 模块的编译阶段 tmp\kotlin-classes 文件夹为空且找不到路径?
- scala - scala程序中的java.lang.ClassNotFoundException
- matlab - 读取具有已知数据类型序列的二进制文件
- sql-server - 具有定义起点的递归 SQL 查询
- firebase - 如何在不覆盖孩子的情况下更新?
- javascript - 如何在 Node 中获取 ES 模块父级?
- java - SAP PI UDF 将没有时间的日期转换为日期时间 ISO8601 字符串
- firebase - 如何在颤动中取消firebase异步请求而不是检查已安装
- android - 以编程方式打开 Android 通知
- android-studio - Android Studio 坚持解决 Flutter 中的依赖关系