Skip to content

[3.x] Vite SSR Dev Server adds duplicate base path #2932

@neluba

Description

@neluba

Inertia version

3.x (beta)

Inertia adapter(s) affected

  • React
  • Vue 3
  • Svelte
  • Not Applicable

JS package version

@inertiajs/vite: 3.0.0-beta.1

Backend stack (optional)

I'm using Symfony with pentatrion/vite-bundle. But it shouldn't matter here.

Describe the problem

Hey, while testing the new Dev Server SSR support in the Inertia 3 Beta, I noticed that CSS URLs are incorrectly constructed when a custom base path is defined in the Vite configuration.

I'm not really experienced with the inner workings of Vite, but i suspect that problem is that the origin already contains the base path here:

const href = `${origin}${basePrefix}${url}`


Current link tag output:

<link rel="stylesheet" href="https://localhost:5172/build/build//@fs//Users/<...>/assets/styles/app.css">

Expected output:

<link rel="stylesheet" href="https://localhost:5172/build/@fs//Users/<...>/assets/styles/app.css">

Steps to reproduce

// vite.config.ts

export default defineConfig({
    plugins: [
        inertia({ ssr: 'assets/ssr.ts' })
    ],
    base: '/build/', // This causes the issue
});

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