Skip to content

srcExclude doesn't work with vitepress dev #4310

@Veetaha

Description

@Veetaha

Describe the bug

I tried this config:

{
   srcExclude: [
        "./README.md",
        "./infra/**"
    ],
}

But it doesn't work, I still see a web page generated at /README and at /infra/README. The source code of my project is here

Reproduction

git clone git@github.com:elastio/bon.git
cd bon/website
npm install

Then add the config mentioned above to .vitepress/config.mts, and start the dev server:

npm run dev

I also tried **/README.md and **/infra/**, it didn't help.

Expected behavior

There should be no /README and infra/README pages generated.

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
    Memory: 54.58 GB / 62.72 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.13.1 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
  npmPackages:
    vitepress: ^1.4.1 => 1.4.1 

Validations

  • Check if you're on the latest VitePress version.
    Follow our Code of Conduct
    Read the docs.
    Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

Activity

brc-dd

brc-dd commented on Oct 27, 2024

@brc-dd
Member

Seems to work fine for me:

image


(see no infra directory or README.html file is generated)

The other one also works:

image


This should also work:

    srcExclude: ["README.md", "infra/**"]
Veetaha

Veetaha commented on Oct 27, 2024

@Veetaha
Author

Indeed, I think that's an issue with vitepress dev then?

brc-dd

brc-dd commented on Oct 27, 2024

@brc-dd
Member

In dev, those paths won't be discovered by default, but if you access those paths, vite won't block them either.

Veetaha

Veetaha commented on Oct 27, 2024

@Veetaha
Author

I see, so this is expected in dev mode? I did just manually enter the URL path. I suppose there could be a note about this quirck in the docs

changed the title [-]`srcExclude` doesn't work[/-] [+]`srcExclude` doesn't work with `vitepress dev`[/+] on Oct 27, 2024
brc-dd

brc-dd commented on Oct 27, 2024

@brc-dd
Member

You can restrict them though if you want:

    vite: {
        server: {
            fs: {
                deny: ["README.md", "infra/**"],
            },
        },
    },
added
docsImprovements or additions to documentation
and removed on Oct 27, 2024
Veetaha

Veetaha commented on Oct 27, 2024

@Veetaha
Author

Yeah, I see, I just wasn't aware of how dev mode differs in this regard. Frankly, I know nothing about vite though 😅, I just tried the srcExclude option and thought to test it in dev mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to documentationstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Veetaha@brc-dd

        Issue actions

          `srcExclude` doesn't work with `vitepress dev` · Issue #4310 · vuejs/vitepress