【问题标题】:What it means **/node_modules/* in tsconfig.json?tsconfig.json 中的 **/node_modules/* 是什么意思?
【发布时间】:2021-12-14 00:47:31
【问题描述】:

this official docs of Visual Code 中,建议将node_modules 添加到tsconfig.json 的exclude 字段中。这样做是这样的:

{
  "compilerOptions": {
    "allowJs": true,
    "checkJs": true
  },
  "exclude": ["node_modules", "**/node_modules/*"]
}

如果我已经添加了普通的 node_modules 文件夹,我想知道为什么还需要 **/node_modules/*

【问题讨论】:

  • 排除根级node_modules文件夹中的任何node_modules子文件夹(任意深度)。
  • 不要尝试在与 glob 匹配的文件夹中查找要编译的文件

标签: javascript node.js typescript visual-studio-code eslint


【解决方案1】:

**/node_modules/* 是一个 glob 模式,意思是(从右到左)“node_modules 目录下的任何内容任何深度”。有关更多详细信息,请参阅glob 模块,它很可能是用于解释该模式的模块。

来自他们的文档:

  • * 匹配单个路径部分中的 0 个或多个字符
  • ** 如果“globstar”在路径部分中单独存在,则它匹配零个或多个目录和子目录以搜索匹配项。它不会抓取符号链接的目录。

【讨论】:

    猜你喜欢
    • 2020-02-06
    • 1970-01-01
    • 2011-08-12
    • 2017-06-11
    • 2018-03-05
    • 2023-03-27
    • 1970-01-01
    • 1970-01-01
    • 2010-09-29
    相关资源
    最近更新 更多