rackt-org / rackt-org.github.io

2 stars 2 forks source link

Intended workflow? #3

Open srfoster opened 2 years ago

srfoster commented 2 years ago

I'm trying to use this project as a template to help me understand how to integrate RacketScript/Rackt in my own projects. I was able to get it to build, but I feel my workflow is different from what you're intending. I'll say what I did, and maybe you can say what I should have done?

Setup

1) I installed racketscript (raco pkg install racketscript). 2) I installed rackt (git clone git@github.com:rackt-org/rackt.git; cd ./rackt; raco pkg install) 3) I cloned this repo.

Build

1) In the cloned directory, I ran racks src/app.rkt 2) I served the cloned directory and viewed index.html in my browser

I got errors that indicated that "react-dom" was not being found.

After some digging around and some failed attempts, I stumbled upon the following workflow, which worked:

1) cd into the local rackt directory produced from racks command. 2) Did npm init; npm install react react-dom 3) Re-ran racks with racks --target webpack src/app.rkt 4) Ran cd js-build; npx webpack 5) Edited index.html's relevant <script /> tag to load /js-build/dist/main.js instead of /js-build/modules/app.rkt.js 6) Visited the served index.html file in my browser and it worked!

This is really exciting! I'm excited to start using this.

However, given that I edited an html file, I'm sure your workflow is different from mine. What should I be doing?

srfoster commented 2 years ago

Update. On further examination, I think my step 2 above was unnecessary:

2) Did npm init; npm install react react-dom

My process works without it.