-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Porting to NPM package #6
Comments
Do you mean for usage from Node.js or just for frontend distribution? It's certainly possible, you'd just need to create a package that wraps the JS+Wasm files in this project. |
I mean that a user can do a However I'm not sure what are things needed during buildtime and what things are actually needed for running the package. From quick filesystem analysis it seems that just the ui/libapi.* items are needed? (I don't have much experience with (p)react and I'm struggeling to distinguish between the framework and the newly provided web-gphoto2 functionality haha). |
I'm getting a bit stuck unfortunately. I created a package and repository (both temporary, several things are not fixed like license and readme) But currently I'm running into issues like the word But the bigger issue: The libapi.mjs file uses the What strikes me is that your demo does not have this error even though your UI code uses ES6 syntax. How is that possible? |
Hmm those paths in libapi.mjs should not be reachable from the Web, they only trigger from Node.js code but as you noted this library was only built and used from the Web before, and successfully so. I'm not sure why Svelte complains, but also I don't have much free time to look into this deeper at the moment. FWIW I don't think you need a separate repo, I'd prefer the end result to be a PR to package.json in this one so it all stays together and is easily discoverable. |
Once I get it working I'll be sure to make a PR! For now this is just testing and trying to get it to work. |
Done! The reason the package wasn't working is because Svelte statically analyzes the files in the build toolchain so require is seen as a statement, and the build toolchain doesn't know it is inside a condition that will never be true in a browser environment ( I have created a PR with everything you need to publish this project to NPM in #7 . Please let me know if you have any feedback or suggestions! |
Thank you very much. I've been trying to use this repository in the Sveltekit, Electron environment for the past few weeks. However, I was unable to solve the aforementioned problem due to my low level of development skills. I'm really looking forward to it. Thank you very much. |
Ah you might want to try adding Maybe also upgrade Emscripten Docker version while at it just in case there were more fixes. |
I have tried for a bunch of hours to try and accomplish this but I was ultimately unsuccessful. For some reason environment flags are starting to behave weird when upgrading so the EM_CACHE variable is not correctly transitioned into the build process which crashes everything. I tried to switch to 3.1.44 (latest release) |
Ok then leave the upgrade for now, just change the |
This is now published on npm: https://www.npmjs.com/package/web-gphoto2 Thanks @icheered! |
First of all: Awesome project. This is exactly the type of application that I hoped would be made possible by the introduction of WASM.
Now onto the question: I read that you're no longer supporting this project but it is still quite capable in its current version. I have never done it before, but would it technically be possible to turn this into an NPM package? I have very little experience with WASM or the other tools you used to built this application, but I imagine this would be quite popular with other programming photographers.
The text was updated successfully, but these errors were encountered: