Using Cloudflare Adapter
Hey, I really like this project and would love to use it, but currently I can't build it for Cloudflare.
Whole error message is below, but the node dependencies seam to be the problem. Is it possible to change the build process to not use them?
If it's a lot of work, I would gladly contribute some solution myself, but I need to know what has to be done.
Thank you in advance. :)
Error Message
✘ [ERROR] Could not resolve "path"
node_modules/@svelteness/kit-docs/node/index.js:1:19:
1 │ import __path from 'path';
╵ ~~~~~~
The package "path" 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] Could not resolve "url"
node_modules/@svelteness/kit-docs/node/index.js:2:49:
2 │ import { fileURLToPath as __fileURLToPath } from 'url';
╵ ~~~~~
The package "url" 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] Could not resolve "module"
node_modules/@svelteness/kit-docs/node/index.js:3:49:
3 │ import { createRequire as __createRequire } from 'module';
╵ ~~~~~~~~
The package "module" 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] Could not resolve "fs"
node_modules/@svelteness/kit-docs/node/index.js:20673:46:
20673 │ import { readFileSync as readFileSync3 } 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] Could not resolve "process"
node_modules/@svelteness/kit-docs/node/index.js:20685:21:
20685 │ import process2 from "process";
╵ ~~~~~~~~~
The package "process" 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] Could not resolve "stream"
node_modules/@svelteness/kit-docs/node/index.js:20701:26:
20701 │ import { Transform } from "stream";
╵ ~~~~~~~~
The package "stream" 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] Could not resolve "crypto"
node_modules/@svelteness/kit-docs/node/index.js:21245:27:
21245 │ import { createHash } from "crypto";
╵ ~~~~~~~~
The package "crypto" 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.
Not entirely sure how to resolve this since Cloudflare workers don't support Node. I'm also not sure why KitDocs is an issue when SvelteKit itself uses Node. Did you accidentally import from @svelteness/kit-docs/node in a client-side file such as a page?
Thank you for quick response. :)
Now I see that I've imported @svelteness/kit-docs/node as I followed the tutorial.
svelte.config.js:
3 import preprocess from "svelte-preprocess";
4: import { kitDocsPlugin } from "@svelteness/kit-docs/node";
5 import Icons from "unplugin-icons/vite";
src/routes/kit-docs/[dir].sidebar.json.ts:
1: import { createSidebarRequestHandler } from "@svelteness/kit-docs/node";
2
src/routes/kit-docs/[slug].meta.json.ts:
1: import { createMetaRequestHandler } from "@svelteness/kit-docs/node";
2
From what I see in the documentation, I can create sidebar manually.
But I don't see such possibility for meta endpoint. :|
But it seems to be the correct direction, because when I changed the endpoints to return empty response, the build did work. :)
@mastermakrela Did you manage to resolve this?
This should work because all of the docs can be pre-rendered so I don't think node is needed at runtime.
This seems to be caused by an upstream bug/regression in Svelte Kit. I have created an issue here: https://github.com/sveltejs/kit/issues/9469
Hey, thank you for looking into this. :) Tbh it was a small old project, so I just documented it differently.
So I don't know if this issue is still present.