diff --git a/sbt-scalajs-bundler/src/main/scala-sjs-0.6/scalajsbundler/sbtplugin/Settings.scala b/sbt-scalajs-bundler/src/main/scala-sjs-0.6/scalajsbundler/sbtplugin/Settings.scala index 32b64955..e653586b 100644 --- a/sbt-scalajs-bundler/src/main/scala-sjs-0.6/scalajsbundler/sbtplugin/Settings.scala +++ b/sbt-scalajs-bundler/src/main/scala-sjs-0.6/scalajsbundler/sbtplugin/Settings.scala @@ -96,7 +96,7 @@ private[sbtplugin] object Settings { case other => sys.error(s"You need a ComJSEnv to test (found ${other.name})") }.getOrElse { Def.taskDyn[ComJSEnv] { - assert(ensureModuleKindIsCommonJSModule.value) + assert(ensureModuleKindIsNotNoModule.value) val sjsOutput = fastOptJS.value.data // If jsdom is going to be used, then we should bundle the test module into a file that exports the tests to the global namespace if (requireJsDomEnv.value) Def.task { diff --git a/sbt-scalajs-bundler/src/main/scala-sjs-1.x/scalajsbundler/sbtplugin/Settings.scala b/sbt-scalajs-bundler/src/main/scala-sjs-1.x/scalajsbundler/sbtplugin/Settings.scala index bd8532a1..73057037 100644 --- a/sbt-scalajs-bundler/src/main/scala-sjs-1.x/scalajsbundler/sbtplugin/Settings.scala +++ b/sbt-scalajs-bundler/src/main/scala-sjs-1.x/scalajsbundler/sbtplugin/Settings.scala @@ -10,7 +10,7 @@ import sbt.Keys._ import sbt._ import scalajsbundler.{JSDOMNodeJSEnv, Webpack, JsDomTestEntries, NpmPackage} import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin.autoImport.{installJsdom, npmUpdate, requireJsDomEnv, webpackConfigFile, webpackNodeArgs, webpackResources, webpack} -import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin.{ensureModuleKindIsCommonJSModule, scalaJSBundlerImportedModules} +import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin.{ensureModuleKindIsNotNoModule, scalaJSBundlerImportedModules} import scalajsbundler.sbtplugin.internal.BuildInfo private[sbtplugin] object Settings { @@ -131,7 +131,7 @@ private[sbtplugin] object Settings { jsEnvInput := Def.task { import org.scalajs.jsenv.Input._ - assert(ensureModuleKindIsCommonJSModule.value) + assert(ensureModuleKindIsNotNoModule.value) val prev = jsEnvInput.value val sjsOutput = scalaJSLinkedFile.value.data diff --git a/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/LibraryTasks.scala b/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/LibraryTasks.scala index c2659f1c..f42c37bb 100644 --- a/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/LibraryTasks.scala +++ b/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/LibraryTasks.scala @@ -36,7 +36,7 @@ object LibraryTasks { stage: TaskKey[Attributed[File]], mode: BundlingMode.Library): Def.Initialize[Task[BundlerFile.Library]] = Def.task { - assert(ensureModuleKindIsCommonJSModule.value) + assert(ensureModuleKindIsNotNoModule.value) val log = streams.value.log val emitSourceMaps = (finallyEmitSourceMaps in stage).value val customWebpackConfigFile = (webpackConfigFile in stage).value @@ -82,7 +82,7 @@ object LibraryTasks { stage: TaskKey[Attributed[File]], mode: BundlingMode.Library): Def.Initialize[Task[BundlerFile.Loader]] = Def.task { - assert(ensureModuleKindIsCommonJSModule.value) + assert(ensureModuleKindIsNotNoModule.value) val entry = WebpackTasks.entry(stage).value val loaderFile = entry.asLoader @@ -97,7 +97,7 @@ object LibraryTasks { mode: BundlingMode.LibraryAndApplication) : Def.Initialize[Task[Seq[BundlerFile.Public]]] = Def.task { - assert(ensureModuleKindIsCommonJSModule.value) + assert(ensureModuleKindIsNotNoModule.value) val cacheLocation = streams.value.cacheDirectory / s"${stage.key.label}-webpack-bundle-all" val targetDir = npmUpdate.value val entry = WebpackTasks.entry(stage).value diff --git a/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/ScalaJSBundlerPlugin.scala b/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/ScalaJSBundlerPlugin.scala index 60743d02..5938da44 100644 --- a/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/ScalaJSBundlerPlugin.scala +++ b/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/ScalaJSBundlerPlugin.scala @@ -540,10 +540,10 @@ object ScalaJSBundlerPlugin extends AutoPlugin { KeyRanks.Invisible ) - private[scalajsbundler] val ensureModuleKindIsCommonJSModule = + private[scalajsbundler] val ensureModuleKindIsNotNoModule = SettingKey[Boolean]( - "ensureModuleKindIsCommonJSModule", - "Checks that scalaJSModuleKind is set to CommonJSModule", + "ensureModuleKindIsNotNoModule", + "Checks that scalaJSModuleKind is not set to NoModule", KeyRanks.Invisible ) @@ -570,9 +570,9 @@ object ScalaJSBundlerPlugin extends AutoPlugin { useYarn := false, - ensureModuleKindIsCommonJSModule := { - if (scalaJSLinkerConfig.value.moduleKind == ModuleKind.CommonJSModule) true - else sys.error(s"scalaJSModuleKind must be set to ModuleKind.CommonJSModule in projects where ScalaJSBundler plugin is enabled") + ensureModuleKindIsNotNoModule := { + if (scalaJSLinkerConfig.value.moduleKind != ModuleKind.NoModule) true + else sys.error(s"scalaJSModuleKind must not be set to ModuleKind.NoModule in projects where ScalaJSBundler plugin is enabled") }, webpackBundlingMode := BundlingMode.Default, diff --git a/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/WebpackTasks.scala b/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/WebpackTasks.scala index 5674307a..d7b40f17 100644 --- a/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/WebpackTasks.scala +++ b/sbt-scalajs-bundler/src/main/scala/scalajsbundler/sbtplugin/WebpackTasks.scala @@ -18,7 +18,7 @@ object WebpackTasks { private[sbtplugin] def webpack( stage: TaskKey[Attributed[File]]): Def.Initialize[Task[Seq[Attributed[File]]]] = Def.task { - assert(ensureModuleKindIsCommonJSModule.value) + assert(ensureModuleKindIsNotNoModule.value) val cacheLocation = streams.value.cacheDirectory / s"${stage.key.label}-webpack" val generatedWebpackConfigFile = (scalaJSBundlerWebpackConfig in stage).value