Skip to content

[Bug]: Solid-Start should not reuse Vite's "base" setting for the router #1132

@indeyets

Description

@indeyets

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Vite's "base" setting, which is originally intended as the base-url for assets is reused for solid-router here: https://github.com/solidjs/solid-start/blame/main/packages/start/entry-client/StartClient.tsx#L98

current behaviour is originally defined by @atk and then fine-tuned by @devinrhode2

Expected behavior 🤔

Solid-Start should provide a separate independent setting for router's base-path to support cases when assets are served from one path, but actual app is served from another.

Steps to reproduce 🕹

Steps (sorry, its "fake" data, as I don't know how to make real-life reproduction for this):

  1. Set "base" setting in "vite.config.ts" to https://cdn.example.com/custom/path
  2. Deploy app to https://app.example.com/
  3. Open the page
  4. See that all of dynamic JS-based elements defined "inside" of router are NOT dynamic (hydration didn't run)

Context 🔦

My situation looks like this:

We serve assets (js, css, … files) from the CDN and use both custom host and custom path-prefix there. Vite's "base" setting is perfect for configuring this.

So, for example, it looks like: https://cdn.example.com/custom/path

Solid start reads this setting and reuses the path for the base setting of solid-router.

But the problem is, that the app is served from: https://app.example.com/ and base=/custom/path SILENTLY breaks the routing and while server-side renders the pages, client-side doesn't even try to hydrate them. No error or warning here.

Your environment 🌎

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions