Skip to content

Preview server not working when accessing mpa with base #10369

@nneto

Description

@nneto

Describe the bug

If I have an mpa with base /foo/ where /foo/ is an app and /foo/ext/ another app, I get the pages from /foo/ normally (I've setup the configurePreviewServer plugin), but when trying to access pages from /foo/ext/ I'm getting "Cannot GET" error. The issue is non existent when changing the base from /foo/ to just /.

Here is a minimal reproducible example with base /: https://stackblitz.com/edit/vitejs-vite-6t3tnb
And here is a fork of the same project, but /foo/ as base: https://stackblitz.com/edit/vitejs-vite-ppmfrf

Steps:
On https://stackblitz.com/edit/vitejs-vite-6t3tnb
1 - npm run build
2 - npm run preview
3 - Access /ext/ or /ext/box/form/ and verify that it works

On https://stackblitz.com/edit/vitejs-vite-ppmfrf
1 - npm run build
2 - npm run preview
3 - Access /foo/ext/ or /foo/ext/box/form/ and verify that Cannot GET /foo/ext/ or Cannot GET /foo/ext/box/form/ occurs

Reproduction

https://stackblitz.com/edit/vitejs-vite-ppmfrf

System Info

System:
    OS: Linux 5.18 Fedora Linux 35 (Workstation Edition)
    CPU: (8) x64 Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz
    Memory: 965.08 MB / 15.45 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 8.19.0 - ~/.nvm/versions/node/v16.13.2/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Firefox: 103.0.2

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions