scala-js / scala-js

Scala.js, the Scala to JavaScript compiler
https://www.scala-js.org/
Apache License 2.0
4.61k stars 394 forks source link

`optimizeJS` unreliable ? #272

Closed vendethiel closed 10 years ago

vendethiel commented 10 years ago

Heya,

after building a little project for fun, I tried to run optimizeJS to see how much would the final file weigh. Well... When I try and run sbt optimizeJS, it generates the file example-opt with this content :

(function(){'use strict';({}).a().b();}).call(this);
sjrd commented 10 years ago

I'm pretty sure your packageJS does not work any better, because you have forgotten to update the startup.js file here: https://github.com/Nami-Doc/SideScroller.js.scala/blob/master/js/startup.js with the proper package name and object name of your application.

vendethiel commented 10 years ago

Actually it doesn't even work with the startup.js updated, something about apply_O_O. I'll try to see where that's coming from.

sjrd commented 10 years ago

I recommend using Scala.js v0.3 (in project/build.sbt) and hence scalajs-dom v0.2 (in build.sbt).

vendethiel commented 10 years ago

Yeah, I updated it all. Now chrome/firefox crashes whenever I try to open the tab, haha. Looks like 22mo of JS is a bit too much ... optimizeJS runs out of memory too

sjrd commented 10 years ago

I typically give sbt 1.5 GB of max memory. If you can't afford to allocate that much, IIRC 768 MB is a minimum for optimizeJS not to run out of memory.

vendethiel commented 10 years ago

I can, but I can't afford to watch with optimizeJS :/. I can't basically run index-dev because my chrome tab just crashes (or at least works in the background). 22Meg is really too much, apparently :/

lihaoyi commented 10 years ago

Odd, it works for me, even with 22mb. Maybe try another browser? 22mb is a lot but it's not impossibly large.

On Tue, Feb 18, 2014 at 11:29 AM, Nami-Doc notifications@github.com wrote:

I can, but I can't afford to watch with optimizeJS :/. I can't basically run index-dev because my chrome tab just crashes (or at least works in the background). 22Meg is really too much, apparently :/

Reply to this email directly or view it on GitHubhttps://github.com/scala-js/scala-js/issues/272#issuecomment-35423137 .

vendethiel commented 10 years ago

I'm afraid even firefox won't, I tried already :

It's not the .map files. It seemed to work before 0.2 upgrading though ... ha !