nak/README.md
2022-02-22 12:21:47 -03:00

1.2 KiB

This is a boilerplate for ScalaJS + React apps using Slinky.

Most boilerplates and tutorials for ScalaJS out there use scajajs-bundler, which wraps Webpack and is probably great, but not for me. I don't like Webpack, but would be fine if it worked, however I get very confused about it, get different errors every time I try and I don't like that I don't understand what it is doing.

Apparently all scalajs-bundler does is bundle together the npm packages into the same file that results from the ScalaJS compilation.

Here instead we have two files: one is the one that comes from ScalaJS, target/scala-2.13/app-fastopt/main.js and the other is one that comes from globals.js when built with esbuild, globals.bundle.js. These two are included in index.html.

To start building your app, run yarn start (or npm run start) and it will bundle the dependencies then start watching the Scala files and rebuilding the main app.

If you want to add a new npm dependency, modify globals.js and restart yarn start.