nornagon / saxi

Tools & library for driving the AxiDraw pen plotter
GNU Affero General Public License v3.0
472 stars 55 forks source link

Esbuild investigation #184

Closed jedahan closed 1 year ago

jedahan commented 1 year ago

Since I was getting OOM running the build, I decided to try esbuild. It seems almost to work, here is what I have so far:

esbuild --bundle src/ui.tsx \
  --outfile=dist/ui/main.js \
  --tsconfig=tsconfig.web.json \
  --loader:.svg=file \
  --loader:.worker.js=file \
  --sourcemap \
  --define:IS_WEB=1

I had to manually add <script src="main.js"></script> and <link href="main.css" rel="stylesheet" /> to index.html, and copy that over to dist/ui.

Now the only thing missing is an error "missing navigator.serial" when running the app. Any suggestions welcome.

jedahan commented 1 year ago

Setting to IS_WEB=0 fixes the navigator.serial error (not using webserial to connect this)

jedahan commented 1 year ago

I got esbuild working, which allows saxi to be built on a raspberry pi as webpack OOMs even with 1.5Gb. PR is #186