Skip to content

Relative asset paths broke usage of imagetools #6326

@Amerlander

Description

@Amerlander

Describe the bug

The relative asset paths for the static adapter do not work when I use vite imagetools.

The resulting paths are always starting with ./_app/... instead of /_app/.... So the images are only working on the root path and don't load on any subpage.

I'm not sure whether this has to be adopted in image tools or if there should be an option in svelte kit to disable that behavior. Maybe both. In general, I think relative paths are great and would love to have this feature work with imagetools.

Breaking PR in Svelte Kit: #4250
Coresponding Issue in imagetools: JonasKruckenberg/imagetools#367

Reproduction

  1. clone https://github.com/Amerlander/image-import-test and npm i, npm run build:
  2. Open /about-Page and check the source below the headline.

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz    
    Memory: 11.75 GB / 31.93 GB
  Binaries:
    Node: 16.14.2 - E:\Program Files\nodejs\node.EXE
    Yarn: 1.9.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD    
    npm: 8.5.0 - E:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 104.0.5112.102
    Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.37) 
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.66 
    @sveltejs/adapter-static: ^1.0.0-next.39 => 1.0.0-next.39 
    @sveltejs/kit: next => 1.0.0-next.442 
    @sveltejs/vite-plugin-svelte: ^1.0.2 => 1.0.2 
    svelte: ^3.44.0 => 3.49.0 
    vite: ^3.0.4 => 3.0.9

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1-importantSvelteKit cannot be used by a large number of people, basic functionality is missing, etc.paths.basebugs relating to `config.kit.paths.base`vite

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions