vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.47k stars 1.86k forks source link

Unable to build with project root above package directory #3667

Closed N0W0RK closed 1 month ago

N0W0RK commented 1 month ago

Describe the bug

Trying to have the project root outside the package directory leads to build errors as node is unavailable.

Reproduction

I have the following directory structure:

.                          # document root
├─ .vitepress              # config dir & node root 
   ├─ config.mts
   ├─ package.json         # node Package config
   └─ ...
├─ en_US                   # documentation in english
   └─ ...                  # Markdown files and subdirectories
├─ de_DE                   # documentation in german
   └─ ...                  # Markdown files and subdirectories

Due to the nature of the project I am working on, vitepress has to run in a yarn workspace. The current location for the workspace using vuepress is in the .vuepress folder. The directory structure is analogue to the one above. When executing npx vitepress build .. in the .vitepress directory some imports cannot be resolved. I believe, this is due to code beeing executed in . where vue is unavailable.

Is there a way to solve this, or is it just not reasonable to have the node config below the document root.

Expected behavior

I would expect the code to be executed in the cwd and therefore all imports beeing available.

System Info

OS: Manjaro Linux 6.6.19-1-MANJARO
node: v21.6.2
vue: 3.4.21
vitepress: 1.0.0-rc.45

Additional context

No response

Validations

brc-dd commented 1 month ago

Most likely not any fix unless you install vitepress at root of your monorepo. Some setting of tempDir might also work, but not sure.