首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CanJS与StealJS 0.3.0

CanJS与StealJS 0.3.0
EN

Stack Overflow用户
提问于 2014-10-15 17:47:27
回答 1查看 326关注 0票数 1

我正在使用canjs2.1.0和stealjs0.3.0在一个应用程序上玩:

我有如下的stealconfig.js:

代码语言:javascript
复制
System.config({
    map: {
        "can/util/util": "can/util/jquery/jquery",
        "jquery/jquery": "jquery"
    },
    paths: {
        "jquery": "bower_components/jquery/dist/jquery.js",
        "can/*": "bower_components/canjs/*.js",
        "lodash": "bower_components/lodash/dist/lodash.js",
        "bootstrap" : "bower_components/bootstrap/dist/js/bootstrap.js",
        "bootstrap.css" : "bower_components/bootstrap/dist/css/bootstrap.csscss"
    },
    meta: {
        jquery: {
            exports: "jQuery",
            deps: supportsUnknownElements ? undefined : ["can/lib/html5shiv.js"]
        }
    },
    ext: {
        mustache: "can/view/mustache/system"
    }
});

我的main.js是:

代码语言:javascript
复制
import can from 'can/';
import $ from 'jquery';
import _ from 'lodash';
import LayoutController from 'apps/layout/layout';

can.route.ready();
new LayoutController(document.body, {});

布局.js厕所,如:

代码语言:javascript
复制
(function() {
  'use strict';
  var can = require('can/'),
      layoutView = require('./view/layout.mustache!');
})();

但是我知道这些错误。

代码语言:javascript
复制
GET http://localhost:8080/bower_components/canjs/can.js 404 (Not Found)
GET http://localhost:8080/bower_components/canjs/view/mustache/system.js 404 (Not Found)

我怎样才能解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-15 18:06:29

将CanJS与新的Steal 您需要使用CanJS的次要分支一起使用。还没有一个标签发布支持新版本的偷窃。

您可以使用bower轻松地做到这一点,就像这样(在您的依赖项中):

代码语言:javascript
复制
"canjs": "bitovi/canjs#minor"

其他评论:

1)当您使用CommonJS (就像在layout.js中那样)时,您不需要将它包装在一个自调用函数中。那将通过偷窃来实现。

2)错误提示它找不到文件。您确定您已经运行了“”来安装CanJS吗?你的配置看起来很好。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26388857

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档