fastOptJS::startWebpackDevServer; ~fastOptJS
for development and it works beautifully while editing .scala files.@JSImport("./styles.css", JSImport.Namespace)
(which otherwise works outside of HMR).webpackMonitoredDirectories
and includeFilter
, so whenever I edit/save the css file I can see that the build is triggered ie Build triggered by src/main/resources/styles.css. Running 'fastOptJS'.
but it doesn't actually do a rebuild (which I verified by inspecting library-fastopt.js).BundlingMode.LibraryOnly()
:)
[info] Building webpack library bundles for cazadescuentos-admin-webapp-fastopt in /home/dell/projects/mine/discount-alerts/admin-webapp/target/streams/_global/_global/_global/streams/fastOptJS-webpack-libraries
[info] Writing scalajs.webpack.config.js
[error] ModuleNotFoundError: Module not found: Error: Can't resolve './cazadescuentos-webapp-fastopt-entrypoint.js' in '/home/dell/projects/mine/discount-alerts/admin-webapp/target/scala-2.13/scalajs-bundler/main'
[error] at factory.create (/home/dell/projects/mine/discount-alerts/admin-webapp/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/Compilation.js:925:10)
[error] at factory (/home/dell/projects/mine/discount-alerts/admin-webapp/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
[error] at resolver (/home/dell/projects/mine/discount-alerts/admin-webapp/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
[error] at asyncLib.parallel (/home/dell/projects/mine/discount-alerts/admin-webapp/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
[error] at /home/dell/projects/mine/discount-alerts/admin-webapp/target/scala-2.13/scalajs-bundler/main/node_modules/neo-async/async.js:2830:7
[error] at /home/dell/projects/mine/discount-alerts/admin-webapp/target/scala-2.13/scalajs-bundler/main/node_modules/neo-async/async.js:6877:13
target/scala-2.13/scalajs-bundler/main/
for the missing *-fastopt-entrypoint.js
file? Is everything else there? And what do you normally do to recover from the error?
If I do
sbt:main> inspect main/npmUpdate/crossTarget
[info] Setting: java.io.File = < … project path ...>\app\electron-main\target\scala-2.13\scalajs-bundler\main
Then you can see I get the path correctly, but doing
println((npmUpdate / crossTarget).value.getAbsolutePath())
In a different task in the same submodule yields
< … project path …>\app\electron-main\target\scala-2.13
Does anyone have any ideas for what I’m doing wrong?
@sidnt one of the webpack solutions for this is called Externals https://webpack.js.org/configuration/externals/
Alternatively, you can also define a Scala.js facade with JSGlobal instead of JSImport for your JS dependency, although it will probably be hard to use pre-made facades that already rely on JSImport that way
[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’