gpt4 book ai didi

typescript - 如何禁用TSLint警告-深度导入

转载 作者:行者123 更新时间:2023-12-02 10:56:41 25 4
gpt4 key购买 nike

编译 Angular 通用应用程序时,我收到此警告:

Warning: Entry point 'my-module' contains deep imports into '/src/app/mocks/myModule.ts'. This is probably not a problem, but may cause the compilation of entry points to be out of order.



我在tsconfig中更改了路径,这可以正常工作,并且是我想要的功能。我希望能够禁用此特定警告。我假设可以对 tslint.json 进行一些更改,以允许全部一起进行深度导入,或在此特定情况下允许进行此操作。

ESlint似乎具有 nx-enforce-module-boundaries ,但由于该项目使用TSLint,因此我认为这不适用。但是,无论如何我都没有成功:
{
"extends": "tslint:recommended",
"rules": {
"nx-enforce-module-boundaries": [
true,
{
"allow": [
["/src/app/mocks/myModule.ts"]
]
}
],
...

我在 TSLint Rules中找不到任何对我有帮助的东西。有任何想法吗?

最佳答案

我最终只使用了自定义的webpack,因为我不知道如何禁用警告功能。 Webpack没有深度导入警告:

module.exports = {
plugins: [
new webpack.NormalModuleReplacementPlugin(/^myModule$/, path.join(__dirname, './src/app/mocks/myModule.mock.server.ts')),
]
}

https://github.com/just-jeb/angular-builders/tree/master/packages/custom-webpack

关于typescript - 如何禁用TSLint警告-深度导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61380175/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com