fermyon / spin-js-sdk

https://developer.fermyon.com/spin/javascript-components
Apache License 2.0
49 stars 17 forks source link

Unable to create wasm component #242

Open sriramgarimella opened 2 months ago

sriramgarimella commented 2 months ago

Hi team

I was trying spin-js plugin,by extending it to a existing react application built using vite framework. I had the below command to build the project

"Vite build && npx mkdirp Target && spin js2wasm -o target/xxx.wasm dist/assets/index-xxx.js"

During spin I am getting below error Uncaught reference error: document is not defined inside crates\spin-js-engine.

Can we use the spin-js framework for a application built with framework like vite ? Can you help me with an example code with the integration please

bacongobbler commented 2 months ago

Hey @sriramgarimella, thanks for reaching out!

I suppose the first question I'm curious to know is where do you intend to use this webassembly module. Are you trying to compile it as part of your Spin application, or somewhere else? For example, are you trying to compile your application to WebAssembly so you can run it in the browser?

Once we know the answer to that question, we might be able to point you in the right direction.

If your project is open source, a link to your project would be highly appreciated.