Bones
Bones
CDCloudflare Developers
Created by Bones on 1/27/2025 in #general-help
I replaced `adapter-cloudflare-workers` with `adapter-cloudflare`, it works fine, i am going crazy
I am building a personal blog website with sveltekit and as i am using mdsvex to handle the markdown articles serverside in a +page.server.js file, which to my understanding is considered SSR, i went on to use Cloudflare (CF) Workers instead of CF Pages. This means i ran this command to initialize my svelte project:
npm create cloudflare@latest my-svelte-app -- --framework=svelte --experimental
npm create cloudflare@latest my-svelte-app -- --framework=svelte --experimental
as mentioned in the CF Docs and i edited my svelte.config.js file to look like this:
import adapter from '@sveltejs/adapter-cloudflare-workers';
import { mdsvex } from 'mdsvex';
import rehypeSlug from 'rehype-slug';

/** @type {import('@sveltejs/kit').Config} */
​const config = {
​kit: {
​adapter: adapter({
config: 'wrangler.json',
​platformProxy: {
configPath: 'wrangler.json',
environment: undefined,
experimentalJsonConfig: false,
persist: false
}
})
},

​preprocess: mdsvex({
extensions: ['.svx', '.md'],
rehypePlugins: [rehypeSlug]
}),
extensions: ['.svelte', '.svx', '.md']
};

export default config;
import adapter from '@sveltejs/adapter-cloudflare-workers';
import { mdsvex } from 'mdsvex';
import rehypeSlug from 'rehype-slug';

/** @type {import('@sveltejs/kit').Config} */
​const config = {
​kit: {
​adapter: adapter({
config: 'wrangler.json',
​platformProxy: {
configPath: 'wrangler.json',
environment: undefined,
experimentalJsonConfig: false,
persist: false
}
})
},

​preprocess: mdsvex({
extensions: ['.svx', '.md'],
rehypePlugins: [rehypeSlug]
}),
extensions: ['.svelte', '.svx', '.md']
};

export default config;
based on the Svelte Docs and after some trial and error my wrangler.json file looked like this, and everything worked fine, website deployed successfully etc:
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "my-svelte-app",
"main": ".svelte-kit/cloudflare/_worker.js",
"compatibility_date": "2025-01-26",
"site": {
"bucket": ".svelte-kit/cloudflare",
"include": [
"*"
],
"exclude": [
"*.map"
]
},
"routes": [
{
"pattern": "mydomainname.com/*",
"zone_name": "mydomainname.com"
}
]
}
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "my-svelte-app",
"main": ".svelte-kit/cloudflare/_worker.js",
"compatibility_date": "2025-01-26",
"site": {
"bucket": ".svelte-kit/cloudflare",
"include": [
"*"
],
"exclude": [
"*.map"
]
},
"routes": [
{
"pattern": "mydomainname.com/*",
"zone_name": "mydomainname.com"
}
]
}
But...
3 replies