W
Wasp•2mo ago
khb

Installing opencascade.js into wasp peoject (opensaas)

Hello friends, i am trying to install opencascade.js (a CAD library), i have tried other implementation, useing three.js and CSG (witch did work), however didnt meet my needs, so i need to know how to install this. But i am getting stuck on configuring the bundler / set-up, they talk about webpack. Would somone be able to walk me though how to install this in a wasp project? Would be greatly appreciated. Here is the documentation. https://ocjs.org/docs/getting-started/hello-world
Hello, World! | OpenCascade.js
One of the very powerful feature of OpenCascade is the ability to perform Boolean Operations. With them, you can simply add or subtract different shapes. Let's try that.
10 Replies
kapa.ai
kapa.ai•2mo ago
Hi @khb. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To answer your question about installing opencascade.js into a Wasp project (like OpenSaaS), I'll need to provide some context and explain the process based on Wasp's project structure and dependency management. Wasp projects use a standard Node.js/npm setup for managing dependencies Wasp Dependencies (https://wasp-lang.dev/docs/project/dependencies). To add a new package like opencascade.js, you would typically use npm:
npm install opencascade.js
npm install opencascade.js
This command would add the package to your package.json file in the root of your Wasp project. However, opencascade.js seems to require some specific webpack configuration, which presents a challenge because Wasp uses Vite as its bundler, not webpack Wasp Project Structure (https://wasp-lang.dev/docs/tutorial/project-structure). Unfortunately, I don't have enough information in the provided knowledge sources to give you a definitive solution for configuring opencascade.js with Vite in a Wasp project. The integration might require some custom configuration that isn't covered in the standard Wasp documentation. Here are a few suggestions that might help: 1. You could try to find a Vite-compatible version or configuration for opencascade.js, if one exists. 2. You might need to eject from Wasp's default build setup to use a custom webpack configuration, but this would be a significant change and might not be recommended. 3. Consider reaching out to the Wasp community on Discord (https://discord.gg/rzdnErX) for more specific guidance on integrating complex libraries that require custom bundler configurations. 4. If possible, you might want to explore alternative CAD libraries that are more easily integrated with Vite-based projects. I apologize that I can't provide a more concrete solution. The integration of opencascade.js into a Wasp project seems to be a complex task that might require some advanced configuration beyond what's covered in the standard Wasp documentation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @khb, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
khb
khbOP•2mo ago
Here are some things that i have looked into to try solve my problem (i am not a super experienced coder, so im hoping someone that is more experienced then me could understand this): https://stackoverflow.com/questions/76573721/use-opencascade-js-in-vite-program-when-i-run-and-then-get-some-error-errorc https://github.com/donalffons/opencascade.js/blob/template-nuxt-bridge-vite/starter-templates/ocjs-create-nuxt-app-bridge-vite/components/OcApp.vue
Stack Overflow
Use opencascade.js in Vite program,when I run and then get some err...
My program is typescript + three.js + vue3 + vite . My operation is as follows: // terminal npm i opencascade.js@beta npm i vite-plugin-wasm // vite.config.js import { defineConfig } from 'vite' i...
GitHub
opencascade.js/starter-templates/ocjs-create-nuxt-app-bridge-vite/c...
Port of the OpenCascade CAD library to JavaScript and WebAssembly via Emscripten. - donalffons/opencascade.js
khb
khbOP•2mo ago
Starter Templates | OpenCascade.js
Configuring your bundler and framework to handle Emscripten-generated WebAssembly and JavaScript glue code can be a hassle. Here are some starter templates to get you up and running with your framework and configuration of choice.
khb
khbOP•2mo ago
I found this, one of them is node JS, i think thats what open saas is, ill update this post if i find a solution
Vinny (@Wasp)
Vinny (@Wasp)•2mo ago
hi @khb did you find a solution yet?
khb
khbOP•2mo ago
I did not :(, but i been thinking of other way that i can achieve the same thing, by importing from blender and sclaing the 3d model, but i havent tested that. Excited to post the website here for all you too see soon 🙂 Ill keep this thread updated 🙂
martinsos
martinsos•2mo ago
@khb wasp uses Vite, so it will mstly come down to how this should be set up with Vite! Did you try out configuring it correctly with Vite? ANy issues there/
khb
khbOP•2mo ago
I did try, but i wasn't successful. It was always somthing to do with the web assembly not loading correctly. I tried to include that in the .vite file (with a libary i saw other people useing online) but didnt quite work.
martinsos
martinsos•2mo ago
Got it! If you get back to that and will have details, feel free to share and we can see if we can help with some details. It helps if you can describe in as much detail what you did and what exactly was the error.
Want results from more Discord servers?
Add your server