-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
One last issue on my big SvelteKit 350 to 551 upgrade... I'm using adapter-static to spit out some HTML files and serving those statically, some of those are even dynamic routes and that works fine with export const prerender = true.
The issue I'm having though is, I have a backend proxy I only use in development mode. You can see it added to my repro case in this commit: https://github.com/johnnysprinkles/sveltekit_static_dynamic/commit/e91dbdf61d410d817988b06c890513c76bbd6376 In that example it returns a simple string, but in real life is make an HTTP fetch to my actual backend.
With that in place, "npm run build" ends up failing with this message:
> Using @sveltejs/adapter-static
@sveltejs/adapter-static: all routes must be fully prerenderable (unless using the 'fallback' option — see https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode). Try adding `export const prerender = true` to your root +layout.js/.ts file — see https://kit.svelte.dev/docs/page-options#prerender for more details
- src/routes/api/[...rest]
error during build:
Error: Encountered dynamic routes
at adapt (file:///Users/jpsimons/dev/sveltekit_static_dynamic/node_modules/@sveltejs/adapter-static/index.js:35:12)
at adapt (file:///Users/jpsimons/dev/sveltekit_static_dynamic/node_modules/@sveltejs/kit/src/core/adapt/index.js:28:8)
at Object.handler (file:///Users/jpsimons/dev/sveltekit_static_dynamic/node_modules/@sveltejs/kit/src/exports/vite/index.js:488:12)
at async PluginDriver.hookParallel (file:///Users/jpsimons/dev/sveltekit_static_dynamic/node_modules/rollup/dist/es/shared/rollup.js:22632:17)
at async Object.close (file:///Users/jpsimons/dev/sveltekit_static_dynamic/node_modules/rollup/dist/es/shared/rollup.js:23709:13)
at async Promise.all (index 0)
at async build (file:///Users/jpsimons/dev/sveltekit_static_dynamic/node_modules/vite/dist/node/chunks/dep-db16f19c.js:45667:13)
at async CAC.<anonymous> (file:///Users/jpsimons/dev/sveltekit_static_dynamic/node_modules/vite/dist/node/cli.js:748:9)Is there a way to make the "dynamic route" check logic ignore server endpoints?
Reproduction
The repro is in https://github.com/johnnysprinkles/sveltekit_static_dynamic
If you sync the latest version of that, you can "npm run dev" and everything works using the backend proxy. But "npm run build" fails. It seems like adapter static should just ignore any +server.js files.
Logs
No response
System Info
System:
OS: macOS 12.2.1
CPU: (8) arm64 Apple M1
Memory: 141.84 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.10.0 - ~/.nvm/versions/node/v18.10.0/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v18.10.0/bin/npm
Browsers:
Firefox: 105.0.1
Safari: 15.3
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.80
@sveltejs/adapter-static: ^1.0.0-next.44 => 1.0.0-next.44
@sveltejs/kit: next => 1.0.0-next.511
svelte: ^3.44.0 => 3.50.1
vite: ^3.1.0 => 3.1.6Severity
blocking an upgrade
Additional Information
No response