Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

minification issues #95

Open
Open
@markuz-brasil

Description

@markuz-brasil

First of all, I'm using 6to5 instead of traceur and mocha/chai/sinon instead of karma/jasmine. (and yeah, I ported the tests)

Flame war apart, the tests shouldn't fail. Which doesn't, unless it is minified. (And I didn't bother trying with minified traceur output...)

I pinpointed the issue to the class' context being somehow set to undefined in the minified form. So things like this.list fails because this is undefined.

Here is my project's git (minified) and all passing tests

I'm not clear where the issue actually is. I'm 99% certain that it isn't the testing framework. #93 doesn't fix it either. I'm left with this babel/babel#343, a bug on uglify or on the di framework itself. (or some combination of them)

My work around is something like this:
instead of writing this:

class UserList {}

class UserController {
  constructor(list) {
    this.list = list
  }
}
annotate(UserController, new Inject(UserList))

write this:

class UserList {}

class UserController {
  constructor(list) {
    this.list = list
  }
}

// add a factory around a class :/
annotate(UserFactory, new Inject(UserList))
function UserFactory (list) {
  return new UserController(list)
}

not ideal, but at least it gets the job done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions