Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production mode not working #16

Open
thibaultmeyer opened this issue Nov 17, 2015 · 5 comments
Open

Production mode not working #16

thibaultmeyer opened this issue Nov 17, 2015 · 5 comments

Comments

@thibaultmeyer
Copy link

Hi

I use sbt uglify 1.0.3 on Java Play 2.4.3.

Everything is working on activator run but the pipeline crash with activator stage or activator dist.

It appear that plugin create a folder application.js.min rather than a file .

I've created a topic about this issue : https://groups.google.com/forum/#!topic/play-framework/11Wi5QEV5FU

build.sbt

UglifyKeys.uglifyOps := { js =>
  Seq((js.sortBy(_._2), "application.min.js"))
}

UglifyKeys.uglifyOps in Assets := { js =>
  Seq((js.sortBy(_._2), "application.min.js"))
}

pipelineStages := Seq(uglify)

pipelineStages in Assets := Seq(uglify)

Output

[info] Loading project definition from C:\Users\thiba\Documents\Programmation\io-payintech\project
[info] Set current project to io-payintech (in build file:/C:/Users/Thibault%20Meyer/Documents/Programmation/io-payintech/)
[info] Wrote C:\Users\thiba\Documents\Programmation\io-payintech\target\scala-2.11\io-payintech_2.11-release.pom
[info] Main Scala API documentation to C:\Users\thiba\Documents\Programmation\io-payintech\target\scala-2.11\api...
[info] Compiling 1 Scala source to C:\Users\thiba\Documents\Programmation\io-payintech\target\scala-2.11\classes...
[info] Optimizing 1 JavaScript(s) with Uglify
[info]
[info] Optimizing 1 JavaScript(s) with Uglify
[error] (node) util.error is deprecated. Use console.error instead.
[error] ERROR: can't read file: C:\Users\thiba\Documents\Programmation\io-payintech\target\web\uglify\build\application.min.js
[info]
[info] Packaging C:\Users\thiba\Documents\Programmation\io-payintech\target\scala-2.11\io-payintech_2.11-release.jar ...
model contains 120 documentable templates
[info] Done packaging.
[info] Main Scala API documentation successful.
[info] Packaging C:\Users\thiba\Documents\Programmation\io-payintech\target\scala-2.11\io-payintech_2.11-release-javadoc.jar ...
[info] Done packaging.
com.typesafe.sbt.jse.SbtJsTask$JsTaskFailure: (node) util.error is deprecated. Use console.error instead.
ERROR: can't read file: C:\Users\thiba\Documents\Programmation\io-payintech\target\web\uglify\build\application.min.js

        at com.typesafe.sbt.jse.SbtJsTask$$anonfun$com$typesafe$sbt$jse$SbtJsTask$$executeJsOnEngine$1.apply(SbtJsTask.scala:195)
        at com.typesafe.sbt.jse.SbtJsTask$$anonfun$com$typesafe$sbt$jse$SbtJsTask$$executeJsOnEngine$1.apply(SbtJsTask.scala:167)
        at scala.util.Success$$anonfun$map$1.apply(Try.scala:206)
        at scala.util.Try$.apply(Try.scala:161)
        at scala.util.Success.map(Try.scala:206)
        at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
        at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
        at scala.concurrent.impl.ExecutionContextImpl$$anon$3.exec(ExecutionContextImpl.scala:107)
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
[error] (*:webPipeline) com.typesafe.sbt.jse.SbtJsTask$JsTaskFailure: (node) util.error is deprecated. Use console.error instead.
[error] ERROR: can't read file: C:\Users\thiba\Documents\Programmation\io-payintech\target\web\uglify\build\application.min.js
[error] Total time: 8 s, completed 17 nov. 2015 17:57:37
@pcwiek
Copy link

pcwiek commented Jan 18, 2016

@0xBAADF00D FYI, I encountered the exact same issue. For anyone else that might wander in those corners, my workaround was:

pipelineStages := Seq(digest, gzip)
pipelineStages in Assets := Seq(uglify)

Yes, the downsides include the fact it runs uglification in dev, although uglify without rjs is quick enough, and all scripts are minified - but source maps are included so debugging shouldn't be too much of a hassle.

On the other hand, it actually generates *.min.js files as intended, unlike the production mode, and should allow you to do sbt clean compile stage until a real fix comes along.

@thibaultmeyer
Copy link
Author

Hi,

thanks for this workaround. It working.

@pcwiek
Copy link

pcwiek commented Jan 19, 2016

@0xBAADF00D Honestly, I wouldn't close the issue, since it's a workaround, not a solution. Underlying problem is still there - stage should generate files, not directories.

@thibaultmeyer
Copy link
Author

oh, ok I re-open issue

@thibaultmeyer thibaultmeyer reopened this Jan 19, 2016
@llb4ll
Copy link

llb4ll commented Aug 14, 2017

Can confirm that production mode is not working for latest sbt-uglify 1.0.4 running on Play 2.6.
After running ./sbt stage non-minified javascripts are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants