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
有什么我已经忘记了吗?
答案 0 :(得分:0)
rv
是RequireJS plugin。由于您已将rv
映射到paths
配置中的路径,因此您只需在其名称后加!
前缀。
require(["../lib/ractive", "rv!../templates/Feed/Main"], ...);