Vanilla js/npm in browser?
-
Hi,
I've been using the "experimental" desktop app for some time now, but I have a few issues right now. I was thinking maybe I could try the new V2 branch - I haven't kept up to date.
My biggest concern is that I do not want to use any special language like .jscad files but just plain es6. Is it possible to use vanilla js/npm for the browser app now? I thought I read something like that somewhere…?
I tried to find a thread were I had a discussion about that on Google+ where I think I got confirmation that the electron app was the only way to do vanilla js at the time, but that might have changed I was hoping?
And thanks all the maintainers! Love this project!
-
@viktor-hedefalk said in Vanilla js/npm in browser?:
Or does it resolve those at upload time? Gonna test that…
No, it can't do that? That would be the worst security thing ever on a browser to allow…
Just watched the tutorial series to the end of part 4 - and the cliffhanger for part 5:
https://youtu.be/hnLLNmP_mzA?t=646
"In the next part we will get to how you can split up your design into multiple files…"
-
This post is deleted! -
Nice, I found the video tutorial of V2 - https://youtu.be/h3_6K6MYTFc?t=198
so I understand it definitely is possible, but I'm having issues with my project structure.
I just have a mono-repo with a lib that I require with a relative path beneath the file I try to drop:
const stuff = require('../eurorack-lib/eurorack-lib')
Neither dropping a module (with package.json:main set) nor a simple js file works for me, I just get:
ERROR: Uncaught Error: No file eurorack-lib/eurorack-lib found Line: 802
When uploading a folder it seems to traverse the whole thing, but of course something relative like
'../eurorack-lib/
wont be there. This worked for the desktop app, but not here. I guess it's a no-brainer the webapp can't handle those kinds of relative file imports - the files aren't there.So what's the recommended way if I really want to use node modules as a workflow? If I have a library shared among many designs I mean - I can't just copy it to every design… And I would guess symlinking like
npm link
wouldn't work either? Or does it resolve those at upload time? Gonna test that…If I understand correctly, the
require
s on jscad itself like in the example here: https://github.com/kaosat-dev/gofree/blob/f30e0843ff5fb9872789968d39da03e06458a2a2/cad/tutorial0/index.js#L1 are shot in from the side on the "server" (rather already bundled in the site's js?) but any other module than that would need to be uploaded together with the design, right?Just not sure how to do this correctly… Any tips highly appreciated!