This project provides a starting point for your scala-js-react application.
Project is based on play-with-scalajs-example which is a simple example application showing how you can integrate a Play project with a Scala.js project.
The application contains three directories:
scalajvm
Play application (server side)scalajs
Scala.js application (client side)scala
scala code that you want to share between scalajs and scalajvm (both client and server sides)
$ sbt
> run
$ open http://localhost:9000
- Run your application like a regular Play app
compile
simply triggers the Scala.js compilationrun
triggers the Scala.js compilation on page refresh~compile
,~run
, continuous compilation is also availablestart
,stage
anddist
generate the optimised javascript- the optimised javascript file is selected when the application runs in prod mode (
start
,stage
,dist
)
- Source maps
- Open your browser dev tool to set breakpoints or to see the guilty line of code when an exception is thrown
- Source maps is disabled in production to prevent your users from seeing the source files. But it can easily be enabled in production too if needed
- Two routes and a SourceMaps controller handle sending the Scala files to the browser. It's the Scala.js plugin that handles generating Source Maps
$ sbt eclipse
- Inside Eclipse,
File/Import/General/Existing project...
, choose the root folder to import the projects
$ sbt gen-idea
- Inside IntelliJ,
File/Open...
, choose the root folder to import all the projects (do not useImport Project...
orImport Module...
)