Skip to content
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

Vite build fails when base option has % #19576

Open
7 tasks done
albatroez opened this issue Mar 5, 2025 · 0 comments
Open
7 tasks done

Vite build fails when base option has % #19576

albatroez opened this issue Mar 5, 2025 · 0 comments

Comments

@albatroez
Copy link

Describe the bug

When I put a %%%TEMPLATE%%% in the base option in vite.config.js the build starts to fail. This was working before vite v5.4.0.

I'd expect to get a warning but the build still passes. Use case is I'd like to serve multiple versions of the same app with different base urls. The %%%TEMPLATE%%% is later replaced across files with my own script to create those multiple versions. I suppose this could be done with relative path, but should the build fail like that?

Reproduction

https://stackblitz.com/edit/vitejs-vite-jsfwq5kp?file=package.json

Steps to reproduce

Run npm install followed by npm run build

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: 5.4.0 => 5.4.0

Used Package Manager

npm

Logs

Click to expand!
(!) "base" option should start with a slash.
error during build:
URIError: URI malformed
    at decodeURI (<anonymous>)
    at resolveConfig (file:///home/projects/vitejs-vite-jsfwq5kp/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:66263:18)
    at async build (file:///home/projects/vitejs-vite-jsfwq5kp/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:65160:18)
    at async CAC.eval (file:///home/projects/vitejs-vite-jsfwq5kp/node_modules/vite/dist/node/cli.js:843:5)e

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant