Open SebastiaanDirks opened 2 months ago
Are you able to provide a minimal reproduction?
I am not familiar with sveltekit but I guess it can't bundle wasm module imports in order to make it work on cloudflare pages.
@cf-wasm/og
imports should work well when used in Workers / Pages Functions.
I have similar error with Astro + Cloudflare
Unknown file extension ".wasm" for /home/user/Desktop/Prods/project/node_modules/@cf-wasm/photon/dist/esm/lib/photon_rs_bg.wasm
Stack trace:
at new NodeError (node:internal/errors:405:5)
at defaultGetFormat (node:internal/modules/esm/get_format:142:36)
at DefaultModuleLoader.load (node:internal/modules/esm/loader:263:26)
at new ModuleJob (node:internal/modules/esm/module_job:63:26)
at DefaultModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:156:34)
I'm doing minimal reproduction. Will post shortly.
Ok, so error happens when doing vanilla Astro + cf-wasm/photon https://stackblitz.com/edit/github-s3fqit?file=src%2Fpages%2Findex.astro,src%2Fpages%2Fphoton.ts,package.json&on=stackblitz
Navigate to first link to see it.
Astro supposed to load .wasm
modules by default.
It also happens when i use @astrojs/cloudflare
adapter.
So i got reply from Astro (https://github.com/withastro/astro/issues/12104 ). In short its problem with Vite dev server.
While @cf-wasm/photon
works on Cloudflare it won't work in local dev server. On local,use @cf-wasm/photon/node
.
P.S. Op had reversed problem (working on local and not on CF. I'll leave this here in case someone will need it.)
Whenever I try to build cf-wasm/og for the pages environment, it gives me the following error.
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".bin" for /builds/renderz/renderz-sveltekit-frontend/node_modules/@cf-wasm/og/dist/esm/core/noto-sans-v27-latin-regular.ttf.bin
It works fine on my local machine using the og/node package import. I'm using the latest version of cf-wasm/og in a Sveltekit cloudflare pages project.