设置require.js config时出错

时间:2017-06-12 20:43:39

标签: javascript requirejs ractivejs

Main.js

require.config({
paths: {
    ractive: "../lib/ractive",
    rv: "../loaders/rv",
    waitSeconds: 200
},

name: "main",
out: "../dist/js/main.js",
stubModules: ["rv"]});

Feed.js

require(["../lib/ractive", "../loaders/rv!../templates/Feed/Main"],
function (ractive, feedTemplate) {
 console.log(ractive);
 console.log(feedTemplate);
    "use strict";

的index.html

<script src="js/require.js" data-main="js/modules/Main" ></script>
<script src="js/modules/Feed.js"></script>

Ractive加载正常,但rv不能很好地加载。

rv的错误消息。 Load timeout for modules: ../loaders/rv!../templates/Feed/Main_unnormalized2,ractive

有什么我已经忘记了吗?

1 个答案:

答案 0 :(得分:0)

rvRequireJS plugin。由于您已将rv映射到paths配置中的路径,因此您只需在其名称后加!前缀。

require(["../lib/ractive", "rv!../templates/Feed/Main"], ...);