0

我从早午餐与卓别林样板开始,但我想在混合物中添加 sinon 和 qunit。所以我将它们添加到bower.json并安装它们bower install <lib>。它工作得非常顺利,但现在我想访问这样的功能:

Model = require './model'

module.exports = class Collection extends Chaplin.Collection
  # Mixin a synchronization state machine.
  # _(@prototype).extend Chaplin.SyncMachine
  # initialize: ->
  #   super
  #   @on 'request', @beginSync
  #   @on 'sync', @finishSync
  #   @on 'error', @unsync

  # Use the project base model per default, not Chaplin.Model

    model: Model

    initialize: ->
        @on 'request', @reply

    reply: ->
        console.log QUnit # this works
        console.log Sinon # this error's
        console.log 'requested'

更新:

当我手动构建时brunch build出现错误

error: [Error: Component JSON file     
"/Users/Simon/Development/myparcel/data/myparcel/bower_components/sinon/.bower.json"
must have `main` property. 
See https://github.com/paulmillr/read-components#README]

所以我"main":"sinon.js"没有任何运气就添加到文件中。

4

1 回答 1

0

You need to change a little more you need to change "sinon.js" to "lib/sinon.js" and console.log Sinon to console.log sinon because Sinon uses the sinon global not Sinon

于 2014-09-11T12:37:58.970 回答