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

srcset causes adapter-static build to fail #9369

Closed
johnknoop opened this issue Mar 8, 2023 · 1 comment · Fixed by #9388
Closed

srcset causes adapter-static build to fail #9369

johnknoop opened this issue Mar 8, 2023 · 1 comment · Fixed by #9388
Labels
bug Something isn't working low hanging fruit ready to implement please submit PRs for these issues!
Milestone

Comments

@johnknoop
Copy link

Describe the bug

I initially posted a comment in a separate issue but didn't get any response from that, so I'm creating a separate one instead.

Since upgrading from version 1.0.0-next.224 of SvelteKit, I can no longer have srcset attributes with multiple paths (which is the whole point with srcset attributes.

Current versions:

@sveltejs/kit: 1.9.3
@sveltejs/adapter-static: 2.0.1
svelte: 3.55.1
vite: 4.1.4

The versions I had before, where it worked:

@sveltejs/kit: 1.0.0-next.224
@sveltejs/adapter-static: 1.0.0-next.26
svelte: 3.48.0
vite: 2.7.13

Reproduction

<img
    srcset="/order_thumbnail_400px.png,
            /order_thumbnail_800px.png 1.5x"
    src="/order_thumbnail_400px.png"
    alt="" />

(Both png files are located in /static folder)

Expected result

A successful build

Observed result

Error: Not found: /order_thumbnail_400px.png,/order_thumbnail_800px.png
at resolve (file:///C:/work/hublinwebsite/.svelte-kit/output/server/index.js:2711:18)
at resolve (file:///C:/work/hublinwebsite/.svelte-kit/output/server/index.js:2586:34)
at #options.hooks.handle (file:///C:/work/hublinwebsite/.svelte-kit/output/server/index.js:2755:59)
at respond (file:///C:/work/hublinwebsite/.svelte-kit/output/server/index.js:2584:43)
file:///C:/work/hublinwebsite/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:53
throw new Error(format(details));
^

Error: 404 /order_thumbnail_400px.png,/order_thumbnail_800px.png (linked from /)
at file:///C:/work/hublinwebsite/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:53:12
at save (file:///C:/work/hublinwebsite/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:355:4)
at visit (file:///C:/work/hublinwebsite/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:204:3)

If I remove one of the paths from the srcset attribute:

<img
    srcset="/order_thumbnail_800px.png 1.5x"
    src="/order_thumbnail_400px.png"
    alt="" />

...then it builds successfully.

Logs

Error: Not found: /order_thumbnail_400px.png,/order_thumbnail_800px.png
at resolve (file:///C:/work/hublinwebsite/.svelte-kit/output/server/index.js:2711:18)
at resolve (file:///C:/work/hublinwebsite/.svelte-kit/output/server/index.js:2586:34)
at #options.hooks.handle (file:///C:/work/hublinwebsite/.svelte-kit/output/server/index.js:2755:59)
at respond (file:///C:/work/hublinwebsite/.svelte-kit/output/server/index.js:2584:43)
file:///C:/work/hublinwebsite/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:53
throw new Error(format(details));
^

Error: 404 /order_thumbnail_400px.png,/order_thumbnail_800px.png (linked from /)
at file:///C:/work/hublinwebsite/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:53:12
at save (file:///C:/work/hublinwebsite/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:355:4)
at visit (file:///C:/work/hublinwebsite/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:204:3)

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 12.78 GB / 31.73 GB
  Binaries:
    Node: 18.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 9.3.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (110.0.1587.63)
    Internet Explorer: 11.0.22000.120

Severity

blocking an upgrade

Additional Information

No response

@Rich-Harris Rich-Harris added bug Something isn't working low hanging fruit ready to implement please submit PRs for these issues! labels Mar 8, 2023
@Rich-Harris Rich-Harris added this to the soon milestone Mar 8, 2023
@li6in9muyou
Copy link
Contributor

I'd like to work on this issue.

li6in9muyou added a commit to li6in9muyou/fix-issue-9369-kit that referenced this issue Mar 10, 2023
li6in9muyou added a commit to li6in9muyou/fix-issue-9369-kit that referenced this issue Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low hanging fruit ready to implement please submit PRs for these issues!
Projects
None yet
3 participants