Requirejs 从播放2.3迁移到播放2.4后,require.js(rjs)停止工作

Requirejs 从播放2.3迁移到播放2.4后,require.js(rjs)停止工作,requirejs,playframework-2.3,playframework-2.4,Requirejs,Playframework 2.3,Playframework 2.4,我在过去的工作中遇到了404错误 10:35:40.588 [warn] application - [onHandlerNotFound] GET /assets/javascripts/require.js?v=807475 - 127.0.0.1 我查看了sbt rjs插件的配置指南: 但是我这边的一切都已经准备好了——因为它在2.3上运行得很好 plugin.sbt: // The Typesafe repository resolvers += "Typesafe reposito

我在过去的工作中遇到了404错误

10:35:40.588 [warn] application - [onHandlerNotFound] GET /assets/javascripts/require.js?v=807475 - 127.0.0.1
我查看了sbt rjs插件的配置指南:

但是我这边的一切都已经准备好了——因为它在2.3上运行得很好

plugin.sbt:

// The Typesafe repository resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0")

// BuildInfo available in java addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.2.5")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-stylus" % "1.0.1")

addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.6")

addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
build.sbt:

...
// Asset building pipeline
pipelineStages := Seq(rjs,gzip)
...
HTML模板: 要求={ urlArgs:'v=@url.ASSETS\u VERSION', 等待秒:180 };

编辑2:

添加route.conf行(注意:我没有将路由器更新为“注入”版本)。这可能是个问题吗

GET         /assets/*file                                                              controllers.Assets.at(path="/public", file: String)

结果我不得不改变两件事:

呈现的HTML必须是:

<script data-main="//local.prizeo.com:9000/assets/javascripts/main.js" src="/assets/lib/requirejs/require.js" type="text/javascript"></script>
到build.sbt


如果您知道它的功能,请发表评论-我在示例播放项目中找到了它,但没有找到任何相关文档。

@url.assetWithoutVersion
是自定义类/方法吗?它是自定义类,为了完整性,我添加了实现-它用于处理CDN。
public static String assetWithoutVersion(String path) {
    if (Protocols.HTTP.isUsed(path) || Protocols.HTTPS.isUsed(path)) {

        if(Protocols.HTTP.isUsed(path)) {
            //this should be avoided, since some browsers may refuse o load unsecured content
            DLogger.warn(TAG, "Asset file '" + path + "' has the protocol specified");
        }

    } else if(Protocols.NONE.isUsed(path)) {
        //this is fine
    } else {
        if (USE_CLOUDFRONT_ASSETS) {
            path = Protocols.NONE + getCloudfrontUrl() + "/assets/" + path;
        } else {
            //strip the http or https
            String domain = Play.application().configuration().getString("page.url.base");
            domain = domain.substring(domain.indexOf('/') + 2);
            path = Protocols.NONE + domain + "/assets/" + path;
        }
    }

    return path;

}

public static String asset(String path) {
    //no need to include version on s3 assets
    if (path.contains("static-assets-")) return path;

    return assetWithoutVersion(path) + "?v=" + ASSETS_VERSION;
}
GET         /assets/*file                                                              controllers.Assets.at(path="/public", file: String)
<script data-main="//local.prizeo.com:9000/assets/javascripts/main.js" src="/assets/lib/requirejs/require.js" type="text/javascript"></script>
RjsKeys.paths += ("jsRoutes" -> ("/jsroutes" -> "empty:"))