Skip to content

svelte next.227 breaks production static build on SvelteKit #13510

@ryoppippi

Description

@ryoppippi

Describe the bug

On production build, I got the error like this

Uncaught (in promise) TypeError: s.getAttribute is not a function 

works with next.226, still has issue.

The wired thing is that

vite preview --open # works fine pnpx serve build/ # error

Reproduction

URL: bc5543ca.lp-d1f.pages.dev
Repo: https://github.com/vim-jp-radio/

I'll create minimal reproduction later

I can get the file which causes the error:
attributes.B_d_bZ2m.js

import {A as w, h as d, R as T, T as l, U as I} from "./runtime.Bein7b5p.js"; import {d as q, e as $, f as B, n as M, g as R} from "./disclose-version.B75eKbpn.js"; function C(s, i) { if (i) { const o = document.body; s.autofocus = !0, w( () => { document.activeElement === o && s.focus() } ) } } function D(s, i, o, u) { var c = s.__attributes ?? (s.__attributes = {}); d && (c[i] = s.getAttribute(i), i === "src" || i === "srcset" || i === "href" && s.nodeName === "LINK") || c[i] !== (c[i] = o) && (i === "loading" && (s[l] = o), o == null ? s.removeAttribute(i) : typeof o != "string" && z(s).includes(i) ? s[i] = o : s.setAttribute(i, o)) } function P(s, i, o, u, c=!1, g=!1, F=!1) { var f = i || {} , L = s.tagName === "OPTION"; for (var p in i) p in o || (o[p] = null); u !== void 0 && (o.class = o.class ? o.class + " " + u : u); var O = z(s) , b = s.__attributes ?? (s.__attributes = {}) , y = []; for (const r in o) { let a = o[r]; if (L && r === "value" && a == null) { s.value = s.__value = "", f[r] = a; continue } var h = f[r]; if (a !== h) { f[r] = a; var A = r[0] + r[1]; if (A !== "$$") if (A === "on") { const _ = {} , v = "$$" + r; let t = r.slice(2); var e = R(t); if (q(t) && (t = t.slice(0, -7), _.capture = !0), !e && h) { if (a != null) continue; s.removeEventListener(t, f[v], _), f[v] = null } if (a != null) if (e) s[`__${t}`] = a, B([t]); else { let N = function(E) { f[r].call(this, E) }; i ? f[v] = $(t, s, N, _) : y.push([r, a, () => f[v] = $(t, s, N, _)]) } } else if (r === "style" && a != null) s.style.cssText = a + ""; else if (r === "autofocus") C(s, !!a); else if (r === "__value" || r === "value" && a != null) s.value = s[r] = s.__value = a; else { var n = r; c || (n = M(n)), a == null && !g ? (b[r] = null, s.removeAttribute(r)) : O.includes(n) && (g || typeof a != "string") ? s[n] = a : typeof a != "function" && (d && (n === "src" || n === "href" || n === "srcset") || D(s, n, a)) } } } return i || w( () => { if (s.isConnected) for (const [r,a,_] of y) f[r] === a && _() } ), f } var k = new Map; function z(s) { var i = k.get(s.nodeName); if (i) return i; k.set(s.nodeName, i = []); for (var o, u = T(s); u.constructor.name !== "Element"; ) { o = I(u); for (var c in o) o[c].set && i.push(c); u = T(u) } return i } function S(s) { if (!d && s.loading === "lazy") { var i = s.src; s[l] = null, s.loading = "eager", s.removeAttribute("src"), requestAnimationFrame( () => { s[l] !== "eager" && (s.loading = "lazy"), s.src = i } ) } } export {P as a, S as h, D as s};

Logs

No response

System Info

System: OS: macOS 15.0.1 CPU: (11) arm64 Apple M3 Pro Memory: 1.67 GB / 36.00 GB Shell: 3.7.1 - /opt/homebrew/bin/fish Binaries: Node: 22.8.0 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/node npm: 10.8.2 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/npm pnpm: 9.11.0 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/pnpm bun: 1.1.29 - ~/.local/share/aquaproj-aqua/bin/bun Browsers: Chrome: 129.0.6668.90 Safari: 18.0.1 
 ### Severity annoyance 

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting submitterneeds a reproduction, or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions