Open
Description
Describe the bug
I was making changes to a SvelteKit project that had no problems until yesterday. I use Cloudflare for hosting. I got the error below from Cloudflare:
10:02:35.691 | ✨ Success! Uploaded 63 files (45 already uploaded) (1.94 sec)
-- | --
10:02:35.691 |
10:02:36.270 | ✨ Upload complete!
10:02:40.882 | Success: Assets published!
10:02:41.774 | Error: Failed to publish your Function. Got error: Uncaught Error: No such module "server/devalue". imported from "server/index.js"
My local repository contains node_modules/devalue, which is used in multiple files within node_modules/@sveltejs/kit/src. There is no issue when using yarn dev or npm run preview locally.
"devDependencies": {
"@sveltejs/adapter-cloudflare": "latest",
"@tailwindcss/postcss": "^4.0.15",
"@tuspe/components": "^1.8.0",
"@types/luxon": "^3.4.2",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-svelte": "^3.3.3",
"js-cookie": "^3.0.5",
"postcss": "^8.5.3",
"prettier": "^3.5.3",
"tailwind-merge": "^3.0.2",
"tailwindcss": "^4.0.15",
"typescript": "^5.8.2"
},
"dependencies": {
"@iconify/svelte": "^4.2.0",
"@sveltejs/kit": "^2.20.2",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@zerodevx/svelte-toast": "^0.9.6",
"luxon": "^3.5.0",
"svelte": "^5.25.2",
"svelte-check": "^4.1.5",
"svelte-preprocess": "^6.0.3",
"vite": "^6.2.2"
}Reproduction
I have a normal SvelteKit installation plus this hooks.ts:
import type {Reroute} from '@sveltejs/kit'
export const reroute: Reroute = ({url}) => {
const path = url.pathname,
parts = path.split('/')
parts.shift()
if (parts[0] !== 'en') {
// Example: ['en', 'de'].includes(parts[0])
return path // No need to reroute
}
if (parts.length === 1) {
return '/' // Redirect /en to /
}
// Define your mappings for specific routes
const exactMappings: Record<string, string> = {
'/en/news': '/uutiset',
'/en/games': '/ottelut',
'/en/games/stats': '/ottelut/tilastot'
}
if (exactMappings[path]) {
return exactMappings[path] // Exact match, perform the reroute
}
// Define mappings for routes with a prefix
const prefixMappings: Record<string, string> = {
'/en/news': '/uutiset'
}
for (const englishPrefix in prefixMappings) {
if (path.startsWith(englishPrefix)) {
const finnishPrefix = prefixMappings[englishPrefix]
const suffix = path.substring(englishPrefix.length)
return `${finnishPrefix}${suffix}` // Reroute with the correct prefix and suffix
}
}
}
Logs
System Info
System:
OS: macOS 15.3.2
CPU: (8) arm64 Apple M1
Memory: 70.53 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.9.0 - /usr/local/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.9.2 - /usr/local/bin/npm
bun: 1.1.36 - ~/.bun/bin/bun
Browsers:
Safari: 18.3.1
npmPackages:
@sveltejs/adapter-cloudflare: latest => 1.0.0-next.45
@sveltejs/kit: ^2.20.2 => 2.20.2
@sveltejs/vite-plugin-svelte: ^5.0.3 => 5.0.3
svelte: ^5.25.2 => 5.25.2
vite: ^6.2.2 => 6.2.2Severity
blocking an upgrade
Additional Information
No response
Activity