Skip to content

Commit 7721f37

Browse files
committed
Fix bloop.LinkSpec: filter out non JS files from arguments
1 parent 59092e7 commit 7721f37

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

frontend/src/main/scala/bloop/engine/Interpreter.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,16 @@ object Interpreter {
620620
None
621621
)
622622
.flatMap { state =>
623+
// TODO: We should use `jsEnvInput` to obtain the JS files to run
624+
// (or even use https://github.com/scala-js/scala-js-js-envs to run ideally),
625+
// https://github.com/scala-js/scala-js/blob/6a145af4dc575340a40b80459d1bf15184c3a2da/sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPlugin.scala#L252-L255
626+
// and get command line options from `jsEnv` tasks for Node.js options.
627+
// https://github.com/scala-js/scala-js/blob/6a145af4dc575340a40b80459d1bf15184c3a2da/sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPlugin.scala#L238-L240
628+
// For now, we just filter .js files (so we don't include sourcemap, .wasm files, and __loader.js generated for Wasm), and run them.
629+
val files = targetDirectory.list
630+
.map(_.toString())
631+
.filter(name => name.endsWith(".js") && !name.endsWith("__loader.js"))
623632
// We use node to run the program (is this a special case?)
624-
val files = targetDirectory.list.map(_.toString())
625633
val args = ("node" +: files ::: cmd.args).toArray
626634
if (!state.status.isOk) Task.now(state)
627635
else Tasks.runNativeOrJs(state, cwd, args)

0 commit comments

Comments
 (0)