Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify sample code #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ This repository contains `scalajs-env-phantomjs` for Scala.js 1.x. In Scala.js
// project/plugins.sbt
addSbtPlugin("org.scala-js" % "sbt-scalajs-env-phantomjs" % "1.0.0")

// Add an explicit import if using project/*.scala
import org.scalajs.jsenv.phantomjs.sbtplugin.PhantomJSEnvPlugin.autoImport._

// build.sbt (inside .settings(...) for multi-project builds)
jsEnv := PhantomJSEnv().value
scalaJSLinkerConfig ~= { _.withESFeatures(_.withUseECMAScript2015(false)) }
Test / jsEnv := PhantomJSEnv().value
Test / scalaJSLinkerConfig ~= { _.withESFeatures(_.withUseECMAScript2015(false)) }
Comment on lines -16 to +20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I agree with those changes. It's fairly intentional that we don't specify Test /, so that the two settings apply equally in the Compile and Test configurations. Did you have a specific issue by not putting them in Test /?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrt the jsEnv, no issue; just limiting it's scope. The scalaJSLinkerConfig OTOH is critical that I scope by Test because I don't the real/main/non-test output coming out in ES3. I want to keep the main artifacts on ES6 and only limit the test JS to ES3 for PhantomJS. I could be wrong but I think the 99% case is going to be running tests cos it's 1 or 2 orders of magnitude faster than Node.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, I see. In that case I would still prefer that we keep the general form first, but we can a paragraph afterwards starting with something like "If you want the changes above to only apply in the Test configuration, you can scope the settings with Test / as follows:"

```

The last line is needed because Scala.js emits ECMAScript 2015 code by default,
Expand Down