4

This is my current setup for Play 2.2.x requireJS. Will it continue to work after 2.3? I can't find requireJs or requireJsShim anywhere in the 2.3 documentation.

  requireJs ++= Seq("mainAccount.js", "mainOrg.js", "mainPublic.js"), // This tells Play to optimize this file and its dependencies
  requireJsShim += "build.js", // This tells Play to read the RequireJS "shim" configuration from build.js
  requireJsFolder := "js"

1 Answer 1

7
  1. Instead of requireJs use:

    RjsKeys.modules := Seq(
        WebJs.JS.Object("name" -> "mainAccount"),
        WebJs.JS.Object("name" -> "mainOrg"),
        WebJs.JS.Object("name" -> "mainPublic")
    )
    
  2. Instead of requireJsShim use RjsKeys.mainConfig := "build"

  3. I think you can just omit requireJsFolder as baseUrl is considered to be either js or javascripts by default. See here: https://github.com/sbt/sbt-rjs/blob/master/src/main/scala/com/typesafe/sbt/rjs/SbtRjs.scala#L104 If you want to change to something else, then use RjsKeys.baseUrl := "your-js-dir-name"

Also there is a github project using RequireJS that was migrated to Play 2.3, may be useful as well: https://github.com/mariussoutier/play-angular-require-seed

For more details check sbt-rjs plugin docs: https://github.com/sbt/sbt-rjs

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.