Closed Atry closed 5 years ago
This is not the right way to fix the problem. The ScalaJSWeb
plugin is used to make the bundle available as an sbt-web asset. If the current implementation doesn’t work correctly we should fix it, but not remove the feature.
The
ScalaJSWeb
plugin is used to make the bundle available as an sbt-web asset.
Not really. What is used to make sbt-web
an asset is WebScalaJS
, not ScalaJSWeb
. The only feature of ScalaJSWeb
is setting-up source mapping, which conflicts with scalajs-bundler
.
Oh, I see. But disabling ScalaJSWeb
means that source maps won’t work anymore… We should check if it is possible to get everything working.
But disabling ScalaJSWeb means that source maps won’t work anymore…
In fact the source mapping file is generated properly as long as ScalaJSWeb
is disabled.
Interesting, thanks for the investigation. Could you add a sentence about that (the docs currently say to follow the “normal” installation instructions of scalajs-web)? And also can you fix the other places where the ScalaJSWeb
plugin is used?
Tests are updated in another PR https://github.com/scalacenter/scalajs-bundler/pull/289
Thanks!
Another workaround for conflicts between ScalaJSWeb
and ScalaJSBundlerPlugin
is to set webpackBundlingMode := BundlingMode.LibraryOnly()
, since ScalaJSBundlerPlugin
does not change Scala.js source mapping in LibraryOnly
mode.
ScalaJSWeb
plug-in will create a source mapping to hash path source file (https://github.com/vmunier/sbt-web-scalajs/blob/1e48af8b505867e12cfcfd212cf4180c87c82ca9/src/main/scala/webscalajs/ScalaJSWeb.scala#L23). Unfortunately, the source file is copied totarget/web/public/main
instead ofclient/target/scala-2.12/scalajs-bundler/main
, which is not accessible from "source-map-loader".As a result, a warning of
NonErrorEmittedError
will be thrown by webpack.We should disable
ScalaJSWeb
to avoid the warning.