Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

srcExclude doesn't work with vitepress dev #4310

Open
4 tasks done
Veetaha opened this issue Oct 27, 2024 · 6 comments
Open
4 tasks done

srcExclude doesn't work with vitepress dev #4310

Veetaha opened this issue Oct 27, 2024 · 6 comments
Labels
docs Improvements or additions to documentation

Comments

@Veetaha
Copy link

Veetaha commented Oct 27, 2024

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 [email protected]: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

@Veetaha Veetaha added the bug: pending triage Maybe a bug, waiting for confirmation label Oct 27, 2024
@brc-dd
Copy link
Member

brc-dd commented Oct 27, 2024

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
Copy link
Author

Veetaha commented Oct 27, 2024

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

@brc-dd
Copy link
Member

brc-dd commented Oct 27, 2024

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

@Veetaha
Copy link
Author

Veetaha commented Oct 27, 2024

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

@Veetaha Veetaha changed the title srcExclude doesn't work srcExclude doesn't work with vitepress dev Oct 27, 2024
@brc-dd
Copy link
Member

brc-dd commented Oct 27, 2024

You can restrict them though if you want:

    vite: {
        server: {
            fs: {
                deny: ["README.md", "infra/**"],
            },
        },
    },

@brc-dd brc-dd added docs Improvements or additions to documentation and removed bug: pending triage Maybe a bug, waiting for confirmation labels Oct 27, 2024
@Veetaha
Copy link
Author

Veetaha commented Oct 27, 2024

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
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants