Skip to content

Conversation

chrisparton1991
Copy link

I have a controller that looks something like this (simplified for example's sake):

function MyCtrl($uibModal, moment) {
    $uibModal.open({
        resolve: {
            moment: () => moment
        }
    });
}

When built, babel prepends an underscore to the moment variable to ensure there are no conflicts with global scope. The result looks something like:

function MyCtrl($uibModal, _moment) {
    $uibModal.open({
        resolve: {
            moment: () => _moment
        }
    });
}

Next, ng-annotate comes along and adds the dependency array:

["$uibModal", "_moment"]

Because _moment isn't a valid dependency, an exception is thrown. Both libraries are doing the right thing, but together they create a painful issue.

Long story short, I've found that running ng-annotate before babel fixes the issue, as babel hasn't had its way with the parameter names yet. I can't see any issues with running ng-annotate first, but I could be mistaken.

P.S. love your work this this seed project, thanks!

@chrisparton1991
Copy link
Author

chrisparton1991 commented Sep 22, 2016

Looks like this screws up sourcemap generation, unfortunately, I'll have to investigate.

Any ideas why this would happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant