scalacenter / scalajs-bundler

https://scalacenter.github.io/scalajs-bundler
Other
234 stars 101 forks source link

Webpack produced JS are not group and world readable #356

Open thesamet opened 4 years ago

thesamet commented 4 years ago

When using fastOptJS::webpack the produced fastopt.js file has the permision rw------- (only user readable and writable). Anything else under target tends is generally world and group readable (rw-r--r--), so this specific file seem to be an exception.

In a development use case, there is an nginx docker container that has target/scala-2.13/scalajs-bundler/main available to it as a volume so it can serve files produced by the host. Due to this, nginx (which runs as different non-root user), can't access the file.

My workaround has been to add the following to my build:

Compile / fastOptJS / webpack := {
    val result = (Compile / fastOptJS / webpack).value
    result.foreach {
        (af: Attributed[File]) =>
            IO.chmod("rw-r--r--", af.data)
    }
    result
}