Skip to content

Static adapter does not honor base path for static files #3232

Closed
@Ghirigoro

Description

@Ghirigoro

Describe the bug

  1. Create a project with a static adapter.
  2. Add this to the config: paths: { base: '/apath'}
  3. Build the project
  4. Preview the project
  5. Note that any files in static folder are resolved at the root and ignore the base path. i.e. localhost:3000/img.png instead of the expected localhost:3000/apath/img.png

I would expect the base path to be honored across the board and not just for js/css files.

Reproduction

NOTE: I'm not sure if this is a bug or static files intentionally must always resolve to the root. If this is expected behavior I'll change this to a feature request, if it is indeed a bug then I will provide a repository highlighting the issue.

Logs

NA

System Info

System:
    OS: macOS 12.0.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 664.50 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.2.0 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.4 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 93.1.29.80
    Chrome: 97.0.4692.71
    Firefox: 95.0.2
    Firefox Developer Edition: 82.0
    Safari: 15.1
  npmPackages:
    @sveltejs/adapter-static: ^1.0.0-next.23 => 1.0.0-next.24 
    @sveltejs/kit: next => 1.0.0-next.216 
    svelte: ^3.42.6 => 3.45.0

Severity

blocking all usage of SvelteKit

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions