-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per Scala.js module esbuild config (#49)
- Loading branch information
Showing
20 changed files
with
352 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
sbt-scalajs-esbuild/src/main/scala/scalajsesbuild/EsbuildScalaJSModuleConfiguration.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package scalajsesbuild | ||
|
||
import scalajsesbuild.EsbuildScalaJSModuleConfiguration.EsbuildPlatform | ||
|
||
final class EsbuildScalaJSModuleConfiguration(val platform: EsbuildPlatform) { | ||
override def toString: String = { | ||
s"EsbuildScalaJSModuleConfiguration($platform)" | ||
} | ||
} | ||
|
||
object EsbuildScalaJSModuleConfiguration { | ||
sealed trait EsbuildPlatform { | ||
def jsValue: String = s"'${toString.toLowerCase}'" | ||
} | ||
object EsbuildPlatform { | ||
case object Browser extends EsbuildPlatform | ||
case object Node extends EsbuildPlatform | ||
case object Neutral extends EsbuildPlatform | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
sbt-scalajs-esbuild/src/sbt-test/sbt-scalajs-esbuild/basic-browser-project/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
enablePlugins(ScalaJSEsbuildPlugin) | ||
|
||
scalaVersion := "2.13.8" | ||
|
||
scalaJSLinkerConfig ~= { | ||
_.withModuleKind(ModuleKind.ESModule) | ||
} | ||
|
||
scalaJSUseMainModuleInitializer := true | ||
|
||
libraryDependencies ++= Seq( | ||
"org.scala-js" %%% "scalajs-dom" % "2.2.0", | ||
"org.scalatest" %%% "scalatest" % "3.2.15" % "test" | ||
) | ||
|
||
lazy val perConfigSettings = Seq( | ||
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv( | ||
org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv | ||
.Config() | ||
.withEnv( | ||
Map( | ||
"NODE_PATH" -> ((esbuildInstall / crossTarget).value / "node_modules").absolutePath | ||
) | ||
) | ||
) | ||
) | ||
inConfig(Compile)(perConfigSettings) | ||
inConfig(Test)(perConfigSettings) |
10 changes: 10 additions & 0 deletions
10
...alajs-esbuild/src/sbt-test/sbt-scalajs-esbuild/basic-browser-project/esbuild/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "basic-project", | ||
"private": true, | ||
"version": "0.0.0", | ||
"devDependencies": { | ||
"esbuild": "0.19.5", | ||
"jsdom": "22.1.0", | ||
"lodash": "4.17.21" | ||
} | ||
} |
Oops, something went wrong.