Giraffe
Giraffe
Explore posts from servers
CDCloudflare Developers
Created by Giraffe on 1/28/2025 in #workers-help
Dynamic require of "tty" is not supported
bump
3 replies
CDCloudflare Developers
Created by Giraffe on 1/28/2025 in #workers-help
Dynamic require of "tty" is not supported
Wrangler
{
"name": "*",
"account_id": "*",
"compatibility_date": "2025-01-14",
"compatibility_flags": ["nodejs_compat_v2"],
"build": {
"command": "bun run build"
},
"main": "./.cloudflare/worker.js",
"site": {
"bucket": "./.cloudflare/public"
},
"observability": {
"logs": {
"enabled": true
}
},
"placement": {
"mode": "smart"
},
"workers_dev": true
}
{
"name": "*",
"account_id": "*",
"compatibility_date": "2025-01-14",
"compatibility_flags": ["nodejs_compat_v2"],
"build": {
"command": "bun run build"
},
"main": "./.cloudflare/worker.js",
"site": {
"bucket": "./.cloudflare/public"
},
"observability": {
"logs": {
"enabled": true
}
},
"placement": {
"mode": "smart"
},
"workers_dev": true
}
Vite config
import { sveltekit } from '@sveltejs/kit/vite'
import type { UserConfig } from 'vite'

import commonjs from '@rollup/plugin-commonjs'
import rollupNodePolyfills from 'rollup-plugin-polyfill-node'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import dynamicImportVars from '@rollup/plugin-dynamic-import-vars'

const production = process.env.NODE_ENV === 'production'

const config: UserConfig = {
optimizeDeps: {
include: [
'tslib'
],
esbuildOptions: {
define: {
global: 'globalThis',
},
}
},
build: {
commonjsOptions: {
include: [],
transformMixedEsModules: true,
requireReturnsDefault: 'auto'
},
rollupOptions: {
external: [],
output: {
exports: 'named',
manualChunks: undefined,
preserveModules: false,
sourcemap: false
},
plugins: [
nodeResolve({
browser: true
}),
rollupNodePolyfills(),
dynamicImportVars({
warnOnError: true
})
]
}
},
plugins: [
commonjs(),
sveltekit()
]
}

export default config
import { sveltekit } from '@sveltejs/kit/vite'
import type { UserConfig } from 'vite'

import commonjs from '@rollup/plugin-commonjs'
import rollupNodePolyfills from 'rollup-plugin-polyfill-node'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import dynamicImportVars from '@rollup/plugin-dynamic-import-vars'

const production = process.env.NODE_ENV === 'production'

const config: UserConfig = {
optimizeDeps: {
include: [
'tslib'
],
esbuildOptions: {
define: {
global: 'globalThis',
},
}
},
build: {
commonjsOptions: {
include: [],
transformMixedEsModules: true,
requireReturnsDefault: 'auto'
},
rollupOptions: {
external: [],
output: {
exports: 'named',
manualChunks: undefined,
preserveModules: false,
sourcemap: false
},
plugins: [
nodeResolve({
browser: true
}),
rollupNodePolyfills(),
dynamicImportVars({
warnOnError: true
})
]
}
},
plugins: [
commonjs(),
sveltekit()
]
}

export default config
3 replies
CDCloudflare Developers
Created by shun on 1/23/2025 in #workers-help
Why does worker build detect that you are using npm for repositories that use bun?
Had bun.lock in the root, and Cloudflare detects bun env via bun.lockb - solved that by adding lockb to the root of the project.
6 replies
CDCloudflare Developers
Created by Giraffe on 1/26/2025 in #workers-help
Bun install or Skip NPM install for Workers
Despite bun.lock I figured I should try adding bun.lockb to the root, and it seems that, that made Cloudflare detect a Bun environment. I guess Workers build just needs to update that🤷🏿‍♂️
10 replies
CDCloudflare Developers
Created by shun on 1/23/2025 in #workers-help
Why does worker build detect that you are using npm for repositories that use bun?
Did you figure anything out?
6 replies
CDCloudflare Developers
Created by Giraffe on 1/26/2025 in #workers-help
Bun install or Skip NPM install for Workers
I've added "packageManager": "[email protected]" to the root package.json of the monorepo as well as the subfolder containing the project, in hopes, that maybe Cloudflare could work out to use Bun ― with no luck.
10 replies
CDCloudflare Developers
Created by Giraffe on 1/26/2025 in #workers-help
Bun install or Skip NPM install for Workers
The goal here, is to skip the NPM install, so that I can use the build command to do bun install prior to the build.
10 replies
CDCloudflare Developers
Created by terribleplan on 3/2/2024 in #workers-help
unable to deploy sveltekit when using postgres
Did you find a solution @terribleplan?
14 replies
CDCloudflare Developers
Created by sanser on 3/31/2024 in #pages-help
postgres in pages
Did you find a solution to this?
7 replies
CDCloudflare Developers
Created by Evil Morty on 5/28/2024 in #pages-help
Cannot use "timers" when deploying to Cloudflare
Same. Did anyone find a solution to this?
4 replies
CDCloudflare Developers
Created by ccfiel on 10/19/2024 in #pages-help
deploying sveltekit in cloudflare pages. I got this error Cannot use "url" when deploying to Cloud
Did you find any solution?
3 replies
CDCloudflare Developers
Created by ccfiel on 10/19/2024 in #pages-help
deploying sveltekit in cloudflare pages. I got this error Cannot use "url" when deploying to Cloud
Same :(
3 replies
DDeno
Created by Siki on 10/10/2024 in #help
Deno workspace with sveltekit(package.json) import native deno library dependency
Btw what I ended up doing was converting the sveltekit app to a ./app/deno.jsonc file. In the ./app/package.json, I use the Bun-syntax. When installing the monorepo, I remove the Bun-syntax from the ./app/package.json, do deno install --allow-scripts and re-add it, and do bun install (Bun will just "apply" the workspace dependency, as there are no other packages)
{
"name": "app",
"version": "0.0.1",
"type": "module",
"devDependencies": {
"library": "workspace:*"
}
}
{
"name": "@scope/app",
"imports": {
"@deno/vite-plugin": "npm:@deno/vite-plugin@^1.0.0",
"@sveltejs/adapter-auto": "npm:@sveltejs/adapter-auto@^3.0.0",
"@sveltejs/kit": "npm:@sveltejs/kit@^2.0.0",
"etc": "..."
{
"name": "app",
"version": "0.0.1",
"type": "module",
"devDependencies": {
"library": "workspace:*"
}
}
{
"name": "@scope/app",
"imports": {
"@deno/vite-plugin": "npm:@deno/vite-plugin@^1.0.0",
"@sveltejs/adapter-auto": "npm:@sveltejs/adapter-auto@^3.0.0",
"@sveltejs/kit": "npm:@sveltejs/kit@^2.0.0",
"etc": "..."
This is good enough for me right now. But definitely an annoyance I hope see fixed🤞🏿
Sidenote since others also use SvelteKit. I had to do { compilerOptions: { runes: true } } in svelte.config.js, as my site was throwing an error when attempting to use svelte legacy. This only happened with the Deno install — so it might be a compatability issue.
7 replies
DDeno
Created by Siki on 10/10/2024 in #help
Deno workspace with sveltekit(package.json) import native deno library dependency
*Related discussions on Github 26138 26721 I see it has already been assigned. Waiting patiently🤞🏿
7 replies
DDeno
Created by Siki on 10/10/2024 in #help
Deno workspace with sveltekit(package.json) import native deno library dependency
In my case, I am planning to build a deno project library into an npm package, as it is an npmjs package already — and wanted to use deno. For the building process I use dnt. (Deno 2.0.6) - ./app sveltekit with package.json (testing suite) - ./library my library I've tried combinations of ./deno.jsonc
{
"workspace": [
"app",
"sveltekit-zero-api"
]
}
{
"workspace": [
"app",
"sveltekit-zero-api"
]
}
and ./package.json
{
"workspaces": [
"app",
"sveltekit-zero-api"
]
}
{
"workspaces": [
"app",
"sveltekit-zero-api"
]
}
⸻⸻⸻⸻⸻⸻ This setup means I have a ./library/package.json with some exports:
{
"name": "library",
"exports": {
".": "./src/index.ts",
"./server": "./src/server/index.ts"
},
"etc": "..."
}
{
"name": "library",
"exports": {
".": "./src/index.ts",
"./server": "./src/server/index.ts"
},
"etc": "..."
}
What I've tried with ./app/deno.jsonc is doing
{
"imports": {
"library": "../library"
}
}
{
"imports": {
"library": "../library"
}
}
after adding the deno-vite-plugin per your suggestion. I've tried the "npm"-way which is ./app/package.json
{
"devDependencies": {
"library": "*"
}
}
{
"devDependencies": {
"library": "*"
}
}
But that just installs the npm package with that name. I've tried the "bun"-way which is ./app/package.json
{
"devDependencies": {
"library": "workspace:*"
}
}
{
"devDependencies": {
"library": "workspace:*"
}
}
but here, workspace isn't recognized. Workaround What have worked, is doing deno install --allow-scripts, then using the beforementioned "bun"-way, and then doing bun install When I run the project, it works as expected. @marvinh. I presume this is not supported yet?
7 replies
DDeno
Created by Giraffe on 11/12/2024 in #help
@std/expect `anyOf` equivalent?
What I'm doing in this case is expect(await a1 ?? 'ok').toBe('ok'), but I'm kinda wondering how I'd do this in a more specific manner, as ?? could just return null.
2 replies