unocss: UnoCSS Inspector does not work with vite `base` config

UnoCSS version

66.1.0-beta.3

Describe the bug

When using base option in vite.config UnoCSS Inspector announces it will use the specified path but in fact doesn’t.

Reproduction

  • create a basic Vite + Vue project (pnpm create vue@latest - doesn’t matter what options are selected)
  • add UnoCSS (pnpm add -D unocss and add it in vite.config)
  • start pnpm dev - UnoCSS Inspector: http://localhost:5173/__unocss/ is displayed and it works
  • set base: '/test', in vite.config
  • start pnpm dev - UnoCSS Inspector: http://localhost:5173/test/__unocss/ is displayed (correct) but it does not work - it is in fact available at http://localhost:5173/__unocss/ where it works

System Info

Ubuntu, Chrome

Validations

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

I discovered the problem: I was missing the final / in the base. The documentation from vite specifies all examples with ending / but it is also auto-fixing it by adding a final /. But the localUrl does not have the final /, so the replacement is not performed.

Sorry for the false alert.

By ‘the 2 are consistent’ I meant as long as what is advertised in console is the URL where the inspector can be accessed 😃

The changes in the commit LGTM.

It’s good from my POV, as long as the 2 are consistent.

No problem, it’s not urgent or critical. It was just to notify there is a discrepancy between what it is displayed in console and the real path.