Reputation: 53
I ran into a problem of reading a file in
unmanagedResourceDirectories
generated by Webpack in production mode. Given the following snippet:
val manifest: Try[JsValue] = Try(Json.parse(
Source.fromFile(new File("/public/manifest.json")).getLines.mkString
))
I want to read sth like /public/manifest.json
.
Upvotes: 1
Views: 389
Reputation: 53
I manage to find the solution for it. Add this to build.sbt
unmanagedResourceDirectories in Assets += (baseDirectory.value / "js-frontend" / "build"),
mappings in Universal ++= directory(baseDirectory.value / "js-frontend" / "build" / "manifest.json"),
And I can have sth like this in code:
val manifest: Try[JsValue] = Try(Json.parse(
Source.fromFile(env.getFile("/manifest.json")).getLines.mkString
))
Upvotes: 1