Open dinfer opened 1 week ago
Hi @dinfer
This issue seems to be not only a HonoX matter, but I think you can make it work with the proper settings of Vite.
@yusukebe Thanks for reply! I've try some vite plugin like https://github.com/Menci/vite-plugin-wasm
(and some other solutions), but nothing seems works well with wasm and cloduflare worker/page environment. Is there any working demo?
It's very thankful to make the cloudflare-page
template works well with wasm.
I'm planning to remove vite form from my project. hmr provided by vite is very convenient, but I have to use wasm.
but nothing seems works well with wasm and cloduflare worker/page environment. Is there any working demo?
Unfortunately, no 😢 I want to try it, but I don't have time to do it (we may need much time to solve it!).
Or have you seen the doc? https://vitejs.dev/guide/features#webassembly
What version of HonoX are you using?
0.1.23
What steps can reproduce the bug?
npm create hono@latest
and selectx-basic
npm install @cf-wasm/photon
app/server.ts
as followingconst app = createApp();
app.basePath("/api").route( "/files", new Hono().post("/upload", async (c) => { const body = await c.req.parseBody(); const file = body.file; if (!(file instanceof File)) { const message = "bad file"; throw new HTTPException(400, { message, res: c.json({ ok: 0, message }), }); } const image = PhotonImage.new_from_blob(file); const width = image.get_width(); const height = image.get_height(); return c.json({ ok: 1, width, height }); }) );
showRoutes(app);
export default app;
20:31:27 [vite] Internal server error: "ESM integration proposal for Wasm" is not supported currently. Use vite-plugin-wasm or other community plugins to handle this. Alternatively, you can use
.wasm?init
or.wasm?url
. See https://vitejs.dev/guide/features.html#webassembly for more details. at LoadPluginContext.load (file:///Users/wentianyi/sidelines/tinybox.site/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:48056:13) at PluginContainer.load (file:///Users/wentianyi/sidelines/tinybox.site/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:49512:17) at async loadAndTransform (file:///Users/wentianyi/sidelines/tinybox.site/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:52306:22) at async instantiateModule (file:///Users/wentianyi/sidelines/tinybox.site/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:53309:44)I got another error
What is the expected behavior?
wasm works fine. as I'm using wasm for cloudflare worker. https://stackoverflow.com/questions/77148379/how-to-use-photon-image-library-on-cloudflare-workers
What do you see instead?
No response
Additional information
No response