Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run ng-annotate before babelify #214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Run ng-annotate before babelify #214

wants to merge 1 commit into from

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