This example project shows how to use Vite together with Scala.js.
You need to:
- Install the javascript libraries:
npm install
- Run the Vite Dev Server:
npm run dev
- Start rebuilding the Javascript code on every source change (in another terminal):
./mill -w publicDev
You need to run:
npm run build
Now you can find your production build in the dist
folder.
You can run the tests with:
./mill __.test
To test the dom we use jsdom. jsdom doesn't support modules so we need building the app with Vite first. This is done in project/vite.mill.scala
Since this is slower than just building the tests with Scala.js we define two separate test suites.
With:
./mill test-pure
You run the pure test suite which doesn't have access to the dom,
With:
./mill test-dom
You can run tests that require the dom against jsdom.