Describe the bug
Hey folks,
I ran into a bit of an edge-case recently while trying to make a hybrid web + Tauri application (web uses adapter-node, Tauri creates an SPA using adapter-static). If there exists a +page.server.js or +layout.server.js file that exports a load() function, running the SPA via a basic web server will throw a 500 internal error, complaining that /__data.json cannot be found. I'm curious if this is an intended bug or if there is a workaround to it.


Reproduction
- Clone this repo and this branch.
- Run
pnpm install.
- Run
pnpm build.
- Using a basic web server tool (I used http-server), start a server (
http-server build).
- Attempt to load in the web browser
Moving or deleting the +layout.server.js file will fix the issue.
Logs
[2022-11-13T23:31:19.546Z] "GET /" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
(node:83494) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
[2022-11-13T23:31:19.576Z] "GET /_app/immutable/start-39da41f2.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.578Z] "GET /_app/immutable/chunks/index-4ce6debf.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.579Z] "GET /_app/immutable/chunks/singletons-eb12c85b.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.589Z] "GET /_app/immutable/chunks/0-bc3f1161.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.590Z] "GET /_app/immutable/chunks/_layout-b03384d3.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.592Z] "GET /_app/immutable/components/layout.svelte-3895ce33.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.592Z] "GET /_app/immutable/chunks/1-f4967476.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.596Z] "GET /_app/immutable/chunks/2-9d7f729d.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.597Z] "GET /_app/immutable/components/error.svelte-52072039.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.600Z] "GET /_app/immutable/components/pages/_page.svelte-6481b931.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.603Z] "GET /__data.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.604Z] "GET /__data.json" Error (404): "Not found"
[2022-11-13T23:31:19.607Z] "GET /__data.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[2022-11-13T23:31:19.607Z] "GET /__data.json" Error (404): "Not found"
[2022-11-13T23:31:19.611Z] "GET /_app/version.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
System Info
System:
OS: macOS 12.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 112.78 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.9.0 - ~/.asdf/installs/nodejs/18.9.0/bin/node
npm: 8.19.1 - ~/.asdf/plugins/nodejs/shims/npm
Browsers:
Brave Browser: 107.1.45.123
Safari: 15.4
npmPackages:
@sveltejs/adapter-static: 1.0.0-next.48 => 1.0.0-next.48
@sveltejs/kit: 1.0.0-next.544 => 1.0.0-next.544
svelte: ^3.53.1 => 3.53.1
vite: ^3.2.3 => 3.2.3
Severity
blocking all usage of SvelteKit
Additional Information
Obviously this isn't completely blocking, from a web standpoint, but it is blocking me from creating a production build of my Tauri app, as I can't create the SPA and my web version (which SSR'd) needs the cookie information passed from +layout.server.js.
Describe the bug
Hey folks,
I ran into a bit of an edge-case recently while trying to make a hybrid web + Tauri application (web uses
adapter-node, Tauri creates an SPA usingadapter-static). If there exists a+page.server.jsor+layout.server.jsfile that exports aload()function, running the SPA via a basic web server will throw a 500 internal error, complaining that/__data.jsoncannot be found. I'm curious if this is an intended bug or if there is a workaround to it.Reproduction
pnpm install.pnpm build.http-server build).Moving or deleting the
+layout.server.jsfile will fix the issue.Logs
System Info
System: OS: macOS 12.3.1 CPU: (10) arm64 Apple M1 Pro Memory: 112.78 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 18.9.0 - ~/.asdf/installs/nodejs/18.9.0/bin/node npm: 8.19.1 - ~/.asdf/plugins/nodejs/shims/npm Browsers: Brave Browser: 107.1.45.123 Safari: 15.4 npmPackages: @sveltejs/adapter-static: 1.0.0-next.48 => 1.0.0-next.48 @sveltejs/kit: 1.0.0-next.544 => 1.0.0-next.544 svelte: ^3.53.1 => 3.53.1 vite: ^3.2.3 => 3.2.3Severity
blocking all usage of SvelteKit
Additional Information
Obviously this isn't completely blocking, from a web standpoint, but it is blocking me from creating a production build of my Tauri app, as I can't create the SPA and my web version (which SSR'd) needs the cookie information passed from
+layout.server.js.