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

vitepress serve tries to load an md.undefined.js file #412

Closed
3 tasks done
valgeirb opened this issue Oct 10, 2021 · 4 comments · Fixed by #856
Closed
3 tasks done

vitepress serve tries to load an md.undefined.js file #412

valgeirb opened this issue Oct 10, 2021 · 4 comments · Fixed by #856
Labels
bug Something isn't working build Related to the build system
Milestone

Comments

@valgeirb
Copy link

valgeirb commented Oct 10, 2021

Describe the bug

First, thank you for your work on this package.

vitepress dev works fine, only when you build the docs and serve them with vitepress serve does this fail.

It tries to load a non-existing file:

app.0e8df899.js:90 GET http://localhost:5000/assets/guide_what-is-vue-popper.md.undefined.js net::ERR_ABORTED 404 (Not Found)

Reproduction

Here's my repo.

  1. Clone it
  2. npm i
  3. Change base in docs/.vitepress/config.js to base: "/"
  4. npm run build:docs
  5. npm run serve:docs
  6. See the error in the dev tools

Expected behavior

I don't understand why vitepress tries to serve this .undefined file.

System Info

System:
    OS: Linux 5.11 Zorin OS 16
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 4.16 GB / 31.23 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
    npm: 6.14.14 - ~/.nvm/versions/node/v14.17.5/bin/npm
  Browsers:
    Chrome: 94.0.4606.81
    Firefox: 93.0

Additional context

No response

Validations

  • 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.
@valgeirb valgeirb added the bug: pending triage Maybe a bug, waiting for confirmation label Oct 10, 2021
@Greasen
Copy link

Greasen commented Mar 9, 2022

我也遇到同样的情况。

@kiaking
Copy link
Member

kiaking commented May 24, 2022

Does this still happen?

@kiaking kiaking added need more info Further information is requested and removed bug: pending triage Maybe a bug, waiting for confirmation labels May 24, 2022
@brc-dd brc-dd closed this as completed Jun 1, 2022
@socheatsok78
Copy link

socheatsok78 commented Jun 8, 2022

Hi, I can confirm that this issue still happening.

Screen Shot 2022-06-08 at 4 45 16 PM

I don't want to create another issue so I'll just comment here.

@brc-dd brc-dd reopened this Jun 8, 2022
@brc-dd
Copy link
Member

brc-dd commented Jun 8, 2022

Replacing

pagePath = pagePath.slice(base.length).replace(/\//g, '_') + '.md'

by

pagePath =
(pagePath.slice(base.length).replace(/\//g, '_') || 'index') + '.md'

should fix this.

@brc-dd brc-dd added bug Something isn't working build Related to the build system and removed need more info Further information is requested labels Jun 8, 2022
@kiaking kiaking added this to the v1.0.0 milestone Jun 16, 2022
brc-dd added a commit that referenced this issue Jun 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working build Related to the build system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants