vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

crash on the first load of `examples/minimal`

Open fi3ework opened this issue 3 years ago • 3 comments

Describe the bug

When starts to dev the examples/minimal in this repository. The first load will trigger a runtime error which is the same as https://github.com/vuejs/core/issues/4344. Everything goes well unless using a linked vitepress so the users won't encounter this error. But it breaks https://github.com/vuejs/vitepress/pull/1012 because of the first load crash. And after a page reload, everything goes well and won't crash anymore, the crash only happens when creating .vite cache. I think it's because packages are optimized by Vite which does not in an un-linked scenario.

image

link

image

un-link

image

I have a workaround to make https://github.com/vuejs/vitepress/pull/1012 pass but I don't really know why packages such as body-scroll-lock are optimized by Vite 🤔. Also, since we are migrating to Vite3, does this issue still exists in Vite3 based vitepress yet? @brc-dd

Reproduction

  1. clone main branch
  2. pnpm i && pnpm build
  3. cd examples/minimal
  4. pnpm dev --force

Expected behavior

no crash at the first page load

System Info

System:
    OS: macOS 12.4
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 267.59 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/Library/Caches/fnm_multishells/22311_1658125341110/bin/node
    npm: 8.5.5 - ~/Library/Caches/fnm_multishells/22311_1658125341110/bin/npm

Additional context

No response

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

fi3ework avatar Jul 19 '22 06:07 fi3ework

does this issue still exists in Vite3 based vitepress

No, not happening for me on chore/vite-3 branch.

brc-dd avatar Jul 19 '22 06:07 brc-dd

does this issue still exists in Vite3 based vitepress

No, not happening for me on chore/vite-3 branch.

Good to hear that. When would the chore/vite-3 branches be merged into main? I will use a workaround to make #1012 pass if chore/vite-3 still needs some time to be merged.

fi3ework avatar Jul 19 '22 06:07 fi3ework

When would the chore/vite-3 branches be merged into main?

It will likely take some time because there are a lot of changes, its hard to review and test them. You can add that workaround if you want. It can be removed later if Vite 3 PR is merged before your one.

brc-dd avatar Jul 19 '22 06:07 brc-dd