8000 createContentLoader() 排除文件的 glob 模式不生效 · Issue #4807 · vuejs/vitepress · GitHub < 8000 meta name="release" content="2a521940a27ab5c584f4838f44c25d790d75e73d">
[go: up one dir, main page]

Skip to content
createContentLoader() 排除文件的 glob 模式不生效 #4807
@peiyanlu

Description

@peiyanlu

Describe the bug

我在使用 createContentLoader() 加载 Markdown 文件时,尝试通过 !**/index.md!**/*-ignore.md 排除某些文件,但这些排除规则没有生效

export default createContentLoader(
  [
    '**/*.md',
    '!**/*-ignore.md',
    '!**/index.md',
  ],
)

直接使用 tinyglobby 是正常的

import { glob } from 'tinyglobby'


glob(
  [
    '**/*.md',
    '!**/*-ignore.md',
    '!**/index.md',
  ],
  { cwd: 'docs' },
).then((res) => {
  console.log(res.length)
})

Reproduction

https://stackblitz.com/edit/vite-createcontentloader?file=docs%2Ftest.data.js

Expected behavior

正确的排除文件

System Info

System:
    OS: Windows 11 10.0.26120
    CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13980HX
    Memory: 35.99 GB / 63.63 GB
  Binaries:
    Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 10.11.0 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (134.0.3124.19)
    Internet Explorer: 11.0.26100.1
  npmPackages:
    vitepress: 2.0.0-alpha.6 => 2.0.0-alpha.6

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildRelated to the build system

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0