[error] Module Warning (from ./node_modules/scalajs-friendly-source-map-loader/index.js):
[error] (Emitted value instead of an instance of Error) Cannot find source file '../../../../../../../../../home/nick/Forks/scala.rx/scalarx/shared/src/main/scala/rx/Ctx.scala': Error: Can't resolve '../../../../../../../../../home/nick/Forks/scala.rx/scalarx/shared/src/main/scala/rx/Ctx.scala' in '/Users/jason/source/erp/erp-front/target/scala-2.12/scalajs-bundler/main’
/home/nick/
even coming from? Possibly related to scalacenter/scalajs-bundler#173. Maybe I ought to ask in the scalajs channel.
../../../../public/fonts/My-Font.eot
const resourcesDir = path.resolve(rootDir, "../common/src/main/resources”);
resolve: {
alias: {
resources: resourceDir
resources/fonts/etc
sbt-web-scalajs-bundler
work with akka http? I tried adapting Play
example, but somethings missing - assets do not seem to link up in classpath, I'm guessing Play
provides some helpful settings under the hood and Akka
doesn't.
sbt shell
and sbt
Run/Debug configurations, issue arises when server
is ran as simple application from the main class through Run/Debug configurations, so it's not completely unusable, just got to fallback to sbt
everywhere.
src/main/js
. While this works fine on the first compilation, changes to the Javascript sources are not picked up by fastOptJS::webpack
. I tried adding webpackMonitoredDirectories += sourceDirectory.value / "js"
, but that didn't help. Would it be possible to have fastOptJS::webpack
automatically detect changes to Javascript sources and retrigger webpack bundling if changes are detected?
fastOptJS / fileInputs += sourceDirectory.value.toGlob / "js" / "*.js"
, but that also didn't help. Maybe I'm misunderstanding SBT internals here?
Hello. I just made the switch from 0.6.x to 1.3.1. I am struggling with getting our build to work again. I hope I can get help here.
We are using ScalaJS with the sbt-web-scalajs-bundler for a small SPA. In 0.6 we imported some static files located in our resource folder like this
@js.annotation.JSImport("resources/Main.scss", js.annotation.JSImport.Default)
which worked fine. After upgrading, webpack complains, that there is no loader defined for our sass files, although we have it in place (as we did before):
[error] Module parse failed: Unexpected character '@' (1:0)
[error] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.[...]
resolve: {
alias: {
'resources': path.resolve(__dirname, '../../../../src/main/js'),
},
modules: [path.resolve(__dirname, 'node_modules')]
},
module: {
rules: [
{
test: new RegExp("\\.scss$"),
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader',
],
}
]
},
Also the source-map-loader emits warnings about not finding the scala sources.
[warn] Module Warning (from ./node_modules/source-map-loader/index.js):
[...]
[warn] NonErrorEmittedError: (Emitted value instead of an instance of Error) Cannot find source file[...]
I guess i am missing something basic here?
i think the problem lies somewhere in the way our folder structure is configured. our client application is located in a "client" subproject
projectroot/client
and the folder layout in there is as follows
projectroot/client/src/main/js
projectroot/client/src/main/scala
projectroot/client/webpack
projectroot/client/public
and this is the config in build.sbt to reflect that layout
webpackResources := baseDirectory.value / "webpack" * "*",
webpackConfigFile in fastLinkJS := Some(baseDirectory.value / "webpack" / "webpack-fastopt.config.js"),
webpackConfigFile in fullLinkJS := Some(baseDirectory.value / "webpack" / "webpack-opt.config.js"),
webpackConfigFile in Test := Some(baseDirectory.value / "webpack" / "webpack-core.config.js"),
webpackDevServerExtraArgs in fastLinkJS := Seq("--inline"),
webpackBundlingMode in fastLinkJS := BundlingMode.LibraryOnly(),
i succeeded in making the whole thing compile when i change the above to use fullOptJS and fastOptJS instead of the linker version. which i don't quite understand to be honest, since to documentation states to use the fast/fullLinkJS in the newest versions.
i still get the sourcemap warnings though
../../../../src/main/scala/org/...
http://localhost:9000/src/main/scala/org/...
http://host/src/*
for the browser to resolve them. Which I'm somewhat OK doing as it's only for development purposes, I can disable that route for production. But since it worked "out of the box" previously before I switched to scalajs-bundler, I thought I'd see if there's a better solution first.
Is there a write up about reducing the bundle size? Quickly scanning through this channel it's kind of a duplicate quesetion being asked... I've seen some docs Bundling mode, but I think there is more to it I think:
At the moment with fullOptJS::webpack
my bundle size is 7,2 mb (using scalajs-react, circe, endpoints4s, droste (local build)).. I guess there are transitive dependencies and maybe code which is not being used?