arboleya / coffee-toaster

Minimalist build system for CoffeeScript.
114 stars 23 forks source link

Uncaught ReferenceError: __t #42

Closed jonathanxmelo closed 11 years ago

jonathanxmelo commented 12 years ago

I'm in debug mode. I get this error - Uncaught ReferenceError: __t

The problem appears to be the way toaster is compiling the coffeescript into js.

Here is the coffeescript -

class Task extends Backbone.Model
    alert "test"

Here is Toaster's output -

(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  __t('models').Task = (function(_super) {

    __extends(Task, _super);

    function Task() {
      return Task.__super__.constructor.apply(this, arguments);
    }

    alert("test");

    return Task;

  })(Backbone.Model);

}).call(this);

Here is the normal coffeescript compiler output (which works fine)

(function() {
  var Task,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  Task = (function(_super) {

    __extends(Task, _super);

    function Task() {
      return Task.__super__.constructor.apply(this, arguments);
    }

    alert("test");

    return Task;

  })(Backbone.Model);

}).call(this);

Why is the output different. How can I fix this?

I love this tool, hopefully I can get it to work right.

jonathanxmelo commented 12 years ago

So far what I have been able to narrow down is that it only happens to .coffee files in folders that are in 'src' folder. Like 'src/models'.

If a .coffee file is just in the 'src' folder it compiles correctly.

Also it seems to process all .coffee files no matter what I define in the folder structure for toast.coffee. Example - here it will also process files in 'src' and 'src/views'

toast 
    folders:
        'src/models': 'models'
arboleya commented 12 years ago

Hi,

The "__t" call is right, it's the helper method that creates the namespaces for you, that output isn't broken, it's fine.

You're probably making some mistake, tell me what is your folder's structure and paste your "toast.coffee" file here for me to check.

arboleya commented 11 years ago

I'm closing this issue due to insufficient details. If you start experiencing these problems with the new version (6.6.4), please re-open it and I'll take a look.