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

Es6 + Webpack + Babel cannot make this work #30

Open
zambov opened this issue Nov 4, 2016 · 3 comments
Open

Es6 + Webpack + Babel cannot make this work #30

zambov opened this issue Nov 4, 2016 · 3 comments

Comments

@zambov
Copy link

zambov commented Nov 4, 2016

Hi all,

cannot make this work, i have all the time unkjnown provider.
Here is my webpack conf:

{
   test: /\.js$/,
   exclude: /(node_modules|bower_components)/,
   loader: 'ng-annotate!babel-loader?presets[]=es2015&presets[]=stage-2&compact=false'
},

Here is my controller:

/** @ngInject /
/

  • @author Trilogis developer
  • prova
  • This is a module generated with trilogis template module scaffolder
    */

class ProvaController {

constructor($log) {

    $log.debug('Instatiated the ProvaController');
    this.name = "ProvaController";
};

}

export default ProvaController;

But i've tried also:

/*
* @author Trilogis developer
* prova
* 
* This is a module generated with trilogis template module scaffolder
*/

class ProvaController {

    constructor($log) {
'ngInject';

        $log.debug('Instatiated the ProvaController');
        this.name = "ProvaController";
    };
}

export default ProvaController;

Any ideas?

@thinkingmedia
Copy link

I don't think ngAnnotate works with classes. You have to use ngInject() to manually inject dependencies.

@zambov
Copy link
Author

zambov commented Apr 28, 2017

Thank you for your reply! I've done it manually.

@thinkingmedia
Copy link

I switched from the loader to the https://github.com/jeffling/ng-annotate-webpack-plugin as it has better support for ES6 features. Import and export work as an example.

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

No branches or pull requests

2 participants