Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
scalajs绑定器阻塞了以本地路径为前缀的源地图URL,例如&x27/http:"x27,;运行fastOptJS::startWebpackDevServer时的源文件_Webpack_Sbt_Scala.js_Scalajs Bundler - Fatal编程技术网

scalajs绑定器阻塞了以本地路径为前缀的源地图URL,例如&x27/http:"x27,;运行fastOptJS::startWebpackDevServer时的源文件

scalajs绑定器阻塞了以本地路径为前缀的源地图URL,例如&x27/http:"x27,;运行fastOptJS::startWebpackDevServer时的源文件,webpack,sbt,scala.js,scalajs-bundler,Webpack,Sbt,Scala.js,Scalajs Bundler,我有一个ScalaJS项目,在Windows 10中运行sbt命令fastOptJS::startwebackdevserver会产生如下错误: [error] (Emitted value instead of an instance of Error) Cannot find source file 'https://raw.githubusercontent.com/japgolly/scalacss/v0.5.3/js/src/main/scala/scalacss/defaults/P

我有一个ScalaJS项目,在Windows 10中运行sbt命令
fastOptJS::startwebackdevserver
会产生如下错误:

[error] (Emitted value instead of an instance of Error) Cannot find source file 'https://raw.githubusercontent.com/japgolly/scalacss/v0.5.3/js/src/main/scala/scalacss/defaults/PlatformExports.scala': Error: Can't resolve './https://raw.githubusercontent.com/japgolly/scalacss/v0.5.3/js/src/main/scala/scalacss/defaults/PlatformExports.scala' in '/project/root/target/scala-2.12/scalajs-bundler/main'
[error]  @ multi (webpack)-dev-server/client?http://localhost:8080 ./mockup-fastopt.js
[error] WARNING in ./mockup-fastopt.js
[error] (Emitted value instead of an instance of Error) Cannot find source file 'https://raw.githubusercontent.com/japgolly/scalacss/v0.5.3/js/src/main/scala/scalacss/internal/Platform.scala': Error: Can't resolve './https://raw.githubusercontent.com/japgolly/scalacss/v0.5.3/js/src/main/scala/scalacss/internal/Platform.scala' in '/project/root/target/scala-2.12/scalajs-bundler/main'
[error]  @ multi (webpack)-dev-server/client?http://localhost:8080 ./mockup-fastopt.js
[error] WARNING in ./mockup-fastopt.js
[error] (Emitted value instead of an instance of Error) Cannot find source file 'https://raw.githubusercontent.com/japgolly/scalacss/v0.5.3/js/src/main/scala/scalacss/internal/mutable/Mutex.scala': Error: Can't resolve './https://raw.githubusercontent.com/japgolly/scalacss/v0.5.3/js/src/main/scala/scalacss/internal/mutable/Mutex.scala' in '/project/root/target/scala-2.12/scalajs-bundler/main'
[error]  @ multi (webpack)-dev-server/client?http://localhost:8080 ./mockup-fastopt.js
这很奇怪,因为它试图从当前目录解析URL,如本部分所示:
错误:无法解析”/https://raw.githubusercontent.com/scala/scala/v2.12.4/src/library/scala/util/control/Breaks.scala“

我还尝试运行了
fastOptJS::webpack
,它不会产生错误,而是产生警告

这是我的build.sbt文件:

import sbt.Keys._

lazy val root: Project = (project in file("."))
  .settings(
    name := Settings.name,
    version := Settings.version,
    scalaVersion := Settings.versions.scala,
    libraryDependencies ++= Settings.scalaJsDependencies.value,
    skip in packageJSDependencies := false,
    npmDependencies in Compile ++= Settings.npmDependencies.value,
    scalaJSUseMainModuleInitializer := true,
    scalaJSUseMainModuleInitializer.in(Test) := false,
    webpackBundlingMode := BundlingMode.Application
  )
  .enablePlugins(ScalaJSPlugin, WorkbenchPlugin, ScalaJSBundlerPlugin)
以及Settings.scala文件:

import sbt._
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._

object Settings {

  val name = """mockup"""
  val version = "0.0.0"

  object versions {
    val materialUi = "0.19.4"
    val react = "16.1.1"
    val scala = "2.12.4"
    val scalaCSS = "0.5.3"
    val scalaJsDom = "0.9.2"
    val scalaJsReact = "1.1.1"
    val scalaJsReactComponents = "1.0.0-M1"
  }

  val npmDependencies = Def.setting(Seq(
    "material-ui" -> versions.materialUi,
    "react" -> versions.react,
    "react-dom" -> versions.react
  ))

  val scalaJsDependencies = Def.setting(
    "org.scala-js"                      %%% "scalajs-dom"              % versions.scalaJsDom             ::
    "com.github.japgolly.scalacss"      %%% "core"                     % versions.scalaCSS               ::
    "com.github.japgolly.scalacss"      %%% "ext-react"                % versions.scalaCSS               ::
    "com.github.japgolly.scalajs-react" %%% "core"                     % versions.scalaJsReact           ::
    "com.github.japgolly.scalajs-react" %%% "extra"                    % versions.scalaJsReact           ::
    "com.olvind"                        %%% "scalajs-react-components" % versions.scalaJsReactComponents ::
    Nil
  )
}
更新1:更改标题并将链接放置到相关链接。原来这个问题是webpack的一个bug


更新2:要解决运行
fastOptJS::startwebackdevserver
时出现的错误,只需在build.sbt中添加
emitSourceMaps:=false
,即可停止使用源代码映射。没有源代码映射很糟糕,但对我来说,至少比没有快速、增量的构建要好。

我有同样的警告,甚至
emitSourceMaps:=false
都无法保存我。它仍然窒息。。。