News for hackers. Stuff that matters.
Re:Announcing Scala.js 0.6.8 by crudbug on Saturday March 19, 2016 @11:39AM (#11318908)
I think all X => JS programming languages should support webpack loaders with commonJS module system for smooth transitions from one language to another.
Re:Announcing Scala.js 0.6.8 by easel on Saturday March 19, 2016 @01:08PM (#11319322)
It would indeed by lovely, but also a bit of a challenge in this case. Part of how scala.js is able to achieve reasonable javascript size is that it uses very aggressive dead code elimination including google closure compiler. In order to do that, it has to see ALL the code that's actually going to be used.

There's nothing preventing that single blob from being exported to webpack. I currently export stuff into a legacy require.js/angular app using globals, so I imagine the same could be accomplished with webpack.

The issue will arise when you attempt to include multiple "scala.js webpack" modules. Each one will be compiled as an independent unit and carry it's own subset of the scala standard libraries, etc. For a transitional scenario, that's probably fine, but it does make participation in a fully polyglot webpack-loader or npm ecosystem problematic.

Re:Announcing Scala.js 0.6.8 by dustingetz on Saturday March 19, 2016 @01:31PM (#11319445)
A simpler case is a scalajs app depending on commonjs modules, I think this should be possible? One problem is that a commonjs module depends on other commonjs modules, so maybe it becomes all or nothing
Re:Announcing Scala.js 0.6.8 by gedy on Saturday March 19, 2016 @04:39PM (#11320334)
Since webpack does dead code elimination as well, wondering if that all needs to be a problem solved in Scala.js?
Re:Announcing Scala.js 0.6.8 by sjrd on Saturday March 19, 2016 @04:58PM (#11320421)
Scala.js does a much better dce than Webpack, or any other JavaScript optimizer (including Closure). It does it at the method level (not top-level function/class level), and can also leverage the type system to do a better job at it. So yes, it needs to be solved at the Scala.js level.

Scala.js also performs whole-program optimizations of the code, besides "simple" dead cole elimination.

Re:Announcing Scala.js 0.6.8 by sjrd on Saturday March 19, 2016 @03:58PM (#11320167)
We are thinking about that: https://github.com/scala-js/scala-js/issues/2175

But, as other comments note, this is a non-trivial problem.

Re:Announcing Scala.js 0.6.8 by crudbug on Saturday March 19, 2016 @08:24PM (#11321181)
Exporting ES6 compatible modules.

Very promising enhancement. Thanks !

Re:Announcing Scala.js 0.6.8 by gedy on Saturday March 19, 2016 @11:41AM (#11318913)
Yes, it would be lovely if one could:

    import 'MyModule' from 'MyModule.scala.js'
easily from Webpack, etc.
Re:Announcing Scala.js 0.6.8 by crudbug on Saturday March 19, 2016 @11:44AM (#11318930)
Agreed!