Skip to content

outDir logic is too confusing now #2716

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

Closed
4 tasks done
ThePlenkov opened this issue Jul 31, 2023 · 3 comments
Closed
4 tasks done

outDir logic is too confusing now #2716

ThePlenkov opened this issue Jul 31, 2023 · 3 comments
Labels
build Related to the build system

Comments

@ThePlenkov
Copy link

ThePlenkov commented Jul 31, 2023

Describe the bug

I'm trying to build a site in a custom folder and noticed several issues.

My site is located in the folder sites/mysite.com.

When I run following command in the root of my project:

npx vitepress build  sites/mysite.com --outDir public

Instead of writing to ${workplaceFolder}/public it actually still resolves outDir relatively to sites/mySite.com so to make it working I need to use currently ../../public or $(pwd)/public which are both too confusing because from CLI call it looks like i write to something above.

My suggestion is that relative path needs to be resolved relatively to cwd, not a docs folder.

But even like that what I find even more strange - this setting only impacts assets, while actual html pages are still located in the .vitepress/dist folder. Do you know how to fix that too? THanks!

Reproduction

Just create a nested project like sites/test.site and try to build it to a public/test.site folder in your root.

Expected behavior

  • command like vitepress build path/to/my/site --outDir public resolves to a public folder in your root - not in the package.
  • html pages should be also built respectively to outDir parameter

System Info

System:
    OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1265U
    Memory: 11.75 GB / 15.34 GB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 20.3.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.7 - /usr/local/bin/npm
    pnpm: 8.6.6 - /usr/local/share/npm-global/bin/pnpm
  npmPackages:
    vitepress: ^1.0.0-beta.6 => 1.0.0-beta.6

Additional context

No response

Validations

@ThePlenkov ThePlenkov added the bug: pending triage Maybe a bug, waiting for confirmation label Jul 31, 2023
@brc-dd
Copy link
Member

brc-dd commented Jul 31, 2023

Specifying outDir from command line is not supported. The way you're invoking, it passes that to vite instead of vitepress.

@brc-dd brc-dd removed the bug: pending triage Maybe a bug, waiting for confirmation label Jul 31, 2023
@ThePlenkov
Copy link
Author

Well, in this case documentation may be confusing too, because I just follow: https://vitepress.dev/reference/cli#vitepress-build

image
So do you want to say that it must not be used at all? Thanks!

@brc-dd
Copy link
Member

brc-dd commented Jul 31, 2023

Ah, the support was added in 22047f3 . The second one is a bug then. Everything should be generated inside outDir. Regarding resolution from cwd vs project root, it's consistent across all the config: https://vitepress.dev/reference/site-config#outdir

@brc-dd brc-dd added bug build Related to the build system labels Jul 31, 2023
@brc-dd brc-dd closed this as completed in 17378c0 Aug 3, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build Related to the build system
Projects
None yet
Development

No branches or pull requests

2 participants