web-infra-dev / rspress

🦀💨 A fast Rspack-based static site generator.
https://rspress.dev
MIT License
1.43k stars 132 forks source link

[Bug]: `preview` command does not work with `base` option enabled #1538

Open JounQin opened 2 days ago

JounQin commented 2 days ago

Version

System: OS: macOS 15.0.1 CPU: (10) arm64 Apple M1 Max Memory: 3.78 GB / 64.00 GB Shell: 5.9 - /bin/zsh Browsers: Chrome: 130.0.6723.91 Safari: 18.0.1 npmPackages: @rspress/core: ^1.35.1 => 1.35.1

Details

https://v6zdkq-4173.csb.app/docs

Image

Image

Reproduce link

https://codesandbox.io/p/devbox/quiet-feather-v6zdkq

Reproduce Steps

  1. run npm i && npm run build && npm run preview
  2. open http://localhost:4173/docs
SoonIter commented 2 days ago

Image

cannot reproduce it

Image

JounQin commented 2 days ago

OK, I found the issue is that base: 'docs' works fine on development, but it requires to be /docs on previewing. Seems a bit inconsistent. :(

JounQin commented 2 days ago

And if server: {open: true} is provided, it will open browser without base which results a 404 page immediately.

Image

Timeless0911 commented 2 days ago

And if server: {open: true} is provided, it will open browser without base which results a 404 page immediately.

Image

server: {
  open: '/docs',
},

see https://rsbuild.dev/config/server/open#serveropen for more details.