You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a prerendered load function file, such as +page.server.ts the file is still included in .svelte-kit/output/server leading to errors when trying to adapt the output for another environment (in my case cloudflare pages).
This wasn't the case in version 1.4.0, the issue seemed to be introduced after that.
Reproduction
git clone https://github.com/jhwz/sveltekit-retains-prerender-assets
cd sveltekit-retains-prerender-assets
npm i
npm run build
Logs
npm run build
> sveltekit-retains-prerender-assets@0.0.1 build
> vite build
vite v4.2.1 building SSR bundle for production...
✓ 51 modules transformed.
11:52:53 am [vite-plugin-svelte] ssr compile done.
package files time avg
sveltekit-retains-prerender-assets 5 36.6ms 7.3ms
vite v4.2.1 building for production...
✓ 42 modules transformed.
11:52:54 am [vite-plugin-svelte] dom compile done.
package files time avg
sveltekit-retains-prerender-assets 3 32.2ms 10.7ms
@sveltejs/kit 2 13.7ms 6.8ms
.svelte-kit/output/client/_app/version.json 0.03 kB
.svelte-kit/output/client/vite-manifest.json 3.19 kB
.svelte-kit/output/client/_app/immutable/chunks/2.b8de9f3d.js 0.08 kB │ gzip: 0.10 kB
.svelte-kit/output/client/_app/immutable/chunks/1.0b92327f.js 0.08 kB │ gzip: 0.10 kB
.svelte-kit/output/client/_app/immutable/chunks/0.982a38f9.js 0.09 kB │ gzip: 0.10 kB
.svelte-kit/output/client/_app/immutable/chunks/3.a583bede.js 0.09 kB │ gzip: 0.10 kB
.svelte-kit/output/client/_app/immutable/entry/test-page.svelte.d7818323.js 0.43 kB │ gzip: 0.31 kB
.svelte-kit/output/client/_app/immutable/entry/_page.svelte.3e0ed68a.js 0.44 kB │ gzip: 0.32 kB
.svelte-kit/output/client/_app/immutable/entry/layout.svelte.b0368388.js 0.54 kB │ gzip: 0.36 kB
.svelte-kit/output/client/_app/immutable/entry/error.svelte.d45f1c66.js 0.98 kB │ gzip: 0.57 kB
.svelte-kit/output/client/_app/immutable/chunks/singletons.0f64ce76.js 2.81 kB │ gzip: 1.44 kB
.svelte-kit/output/client/_app/immutable/entry/app.eb989bb1.js 5.76 kB │ gzip: 2.27 kB
.svelte-kit/output/client/_app/immutable/chunks/index.847936d9.js 7.06 kB │ gzip: 2.86 kB
.svelte-kit/output/client/_app/immutable/entry/start.c881a30f.js 23.31 kB │ gzip: 9.28 kB
✓ built in 274ms
.svelte-kit/output/server/vite-manifest.json 1.67 kB
.svelte-kit/output/server/internal.js 0.19 kB
.svelte-kit/output/server/entries/pages/test/_page.server.ts.js 0.22 kB
.svelte-kit/output/server/entries/pages/_page.svelte.js 0.22 kB
.svelte-kit/output/server/entries/fallbacks/layout.svelte.js 0.24 kB
.svelte-kit/output/server/entries/pages/test/_page.svelte.js 0.35 kB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js 0.83 kB
.svelte-kit/output/server/chunks/index.js 3.27 kB
.svelte-kit/output/server/chunks/internal.js 5.33 kB
.svelte-kit/output/server/index.js 84.89 kB
Run npm run preview to preview your production build locally.
> Using @sveltejs/adapter-cloudflare
✘ [ERROR] Could not resolve "fs"
.svelte-kit/output/server/entries/pages/test/_page.server.ts.js:1:29:
1 │ import { readFileSync } from "fs";
╵ ~~~~
The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.error during build:Error: Build failed with 1 error:.svelte-kit/output/server/entries/pages/test/_page.server.ts.js:1:29: ERROR: Could not resolve "fs" at failureErrorWithLog (/Users/joel/Desktop/sveltekit-retains-prerender-assets/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild/lib/main.js:1604:15) at /Users/joel/Desktop/sveltekit-retains-prerender-assets/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild/lib/main.js:1056:28 at /Users/joel/Desktop/sveltekit-retains-prerender-assets/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild/lib/main.js:1001:67 at buildResponseToResult (/Users/joel/Desktop/sveltekit-retains-prerender-assets/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild/lib/main.js:1054:7) at /Users/joel/Desktop/sveltekit-retains-prerender-assets/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild/lib/main.js:1166:14 at responseCallbacks.<computed> (/Users/joel/Desktop/sveltekit-retains-prerender-assets/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild/lib/main.js:701:9) at handleIncomingPacket (/Users/joel/Desktop/sveltekit-retains-prerender-assets/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild/lib/main.js:756:9) at Socket.readFromStdout (/Users/joel/Desktop/sveltekit-retains-prerender-assets/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild/lib/main.js:677:7) at Socket.emit (node:events:527:28) at addChunk (node:internal/streams/readable:315:12)
Describe the bug
If you have a prerendered load function file, such as
+page.server.ts
the file is still included in.svelte-kit/output/server
leading to errors when trying to adapt the output for another environment (in my case cloudflare pages).This wasn't the case in version
1.4.0
, the issue seemed to be introduced after that.Reproduction
git clone https://github.com/jhwz/sveltekit-retains-prerender-assets cd sveltekit-retains-prerender-assets npm i npm run build
Logs
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: