-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(build): switch to vite 3 and support clean urls #856
Conversation
I've tested this branch in the main Vue docs and aside the from LGTM after the Vue alias resolution is restored. |
Background: pnpm injects `NODE_PATH` when installing npm script binaries in order to simulate flat install structure when running npm scripts. This previously made files outside of VitePress to be able to import transitive deps (e.g. `vue`), but this breaks when upgrading to Vite 3 or in esm mode, because: - "type": "module", aka ESM mode doesn't support `NODE_PATH`, so now project files can't resolve `vue` which is a transitive dep. - Vite 3 now auto-resolves SSR externals, but it requires the dep to be resolvable first. Since it can't resovle `vue`, the Rollup build will fail. The fix: detect if `vue` is resolvable from project root's node_modules. If not, create a symlink to the version of `vue` from VitePress' own deps.
Since we are going to squash the commits, leaving a note about the fix in 3b2d90a: Summary
Background: pnpm injects
The fix: detect if This way we achieve the desired result:
Another point worth mentioning: the reason we have fails like "app data not properly injected" means there are two different copies of Vue being used during SSR. The most likely reason for this is the version of |
Not sure if it's related, but after updating to alpha 6, sidebar just disappeared, even tho I have |
@Lexpeartha can you create an issue and tell us how to reproduce that? Also, aside is for the right-side outline, ads thing and it's true by default. |
You can checkout my repo which had that right-side outline before bumping to the new alpha. I'm assuming something changed internally, since I changed nothing in the actual markdown? |
vitepress serve
tries to load an md.undefined.js file #412vitepress build
fails withERR_REQUIRE_ESM
#476type: "module"
from user #917yarn docs:build
fail #1004examples/minimal
#1016vitepress/client
typings #1127Huge thanks to @georges-gomes, @sapphi-red, @antfu, @patak-dev, @JounQin, @titouanmathis for helping and earlier PRs! And also to people @vitejs for building such awesome stuff!
(Do a squash-merge, the history is messed up here.)
In the meantime if someone wants to test this out without locally linking, you can do this (auto-publishes at 0 UTC):