JSCAD User Group
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Vanilla js/npm in browser?

    Scheduled Pinned Locked Moved General Discussions
    4 Posts 1 Posters 2.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Viktor HedefalkV Offline
      Viktor Hedefalk
      last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • Viktor HedefalkV Offline
        Viktor Hedefalk
        last edited by

        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 requires 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!

        1 Reply Last reply Reply Quote 0
        • Viktor HedefalkV Offline
          Viktor Hedefalk
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • Viktor HedefalkV Offline
            Viktor Hedefalk
            last edited by

            @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…" 🙂

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            Powered by NodeBB | Contributors