scalajs-bundler
scalajs-bundler copied to clipboard
webpack-dev-server doesn't serve files from root
The static example and other examples of using scalajs-bundler generally have an index.html
at the root directory, with a script tag like <script src="target/scala-2.12/scalajs-bundler/main/pcgtest-fastopt-bundle.js">
. But the webpack dev server serves files from the npm directory, so there's no way to have that index.html served up by webpack-dev-server, that I can see.
To work around this:
webpackDevServerExtraArgs in fastOptJS ++= Seq(
"--content-base",
(baseDirectory in ThisBuild).value.getAbsolutePath
)
@MasseGuillaume What’s the behaviour now that #176 has been merged?
It does not. You need to add contentBase. However, this is only for static assets.
If you use a custom webpack config you can even serve multiple directories by passing an array of absolute paths to contentBase. This works well for me. AFAIK you cannot do that with the cli switch.