S. *_* C. 7 node.js monorepo nrwl nrwl-nx nxjs
在同一项目中使用 TS 别名路径时出现错误:Projects should use relative imports to import from other files within the same project
我不想要这种行为。知道如何禁用吗?
我尝试使用该@nrwl/nx/enforce-module-boundaries选项,但它几乎没有关于其选项的文档
// NX doesn't like this line which uses a path to a file within the
// same NX project. It wants me to use relative pathing, which I
// don't want to use
import { fooHandler } from '@handlers/foo';
Run Code Online (Sandbox Code Playgroud)
不得不查看 npm 包,但通过搜索错误文本找到了它。您可以从 .eslintrc.json 设置内部像这样禁用它:
{
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
// This is the part you need to add
{ "allowCircularSelfDependency": true }
]
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4240 次 |
| 最近记录: |