gingko / client

Gingko Writer. Tree-based writing software, written in Elm.
https://gingkowriter.com
MIT License
361 stars 49 forks source link

Setting up dev environment - Elm not defined #240

Closed wowthedoge closed 2 months ago

wowthedoge commented 2 months ago

Hi, I've been trying to get a working environment on my end. I've jumped over most of the hoops, however I think I'll need some help with this one.

Error: Uncaught (in promise) ReferenceError: Elm is not defined

in shared/doc.js, on the line gingko = Elm.Main.init({

In the code, I noticed // import { Elm } from "../elm/Main"; was commented out. Uncommenting it crashes the build with an error in elm/Main.

I've just started using Gingko and I'm liking it a lot. I'd really like to contribute. Thanks!

AdrianoFerrari commented 2 months ago

Hi,

Sorry about the outdated build instructions. I've updated the README to note that I'm slowly switching to Bun and esbuild, so you need install Bun.sh, and call bun run newwatch instead of npm start.

Let me know if you have any more issues.

wowthedoge commented 2 months ago

Hey, I've ran it with bun run newwatch but the same issue still arises. I might be totally off-course - I've been trying to run the web/index.html file after the webpack/bun build. Is this how it's meant to appear in my browser?

AdrianoFerrari commented 2 months ago

No, you're supposed to go to localhost:3000 . Have you also downloaded and run https://github.com/gingko/server ?

wowthedoge commented 2 months ago

Okay, got it. I've now downloaded and run /server and I'm now visiting the page at localhost:3000. However the same problem is still there Uncaught ReferenceError: Elm is not defined. I'm wondering how is the Elm variable available if it's commented out, though?

AdrianoFerrari commented 2 months ago

Sorry about the confustion.

There's probably some mix of old and new build processes in your local copy. The commented out Elm variable is because the new build process using elm-watch automatically adds the Elm variable.

I've updated the build instructions again, in the README: https://github.com/gingko/client/#installation--dev-environment

I think it'd be best to clear out what you've done and start from scratch with those instructions. I've tested them on a fresh install and "It works on my machine" :sweat_smile: .

wowthedoge commented 2 months ago

I finally got a working local copy, phew! I had to install elm-watch, Elm, and run bun run newbuild in the client too. I'm now taking a first look at Elm. Thanks!