andrey-skl / ng-annotate-loader

Webpack loader to annotate angular applications
MIT License
120 stars 28 forks source link

Doesn't work with resolve in ui-router #32

Open cambridgemike opened 7 years ago

cambridgemike commented 7 years ago

This doesn't seem to work with ui-router resolve. Is this a known limitation?

albertpeiro commented 7 years ago

Hey @cambridgemike I checked the list of issues and read yours cause I'm using ui-router. I just installed the plugin and it does seem to work with ui-router out of the box See generated output:

.state('main', {
                url: '/',
                views: {
                    'navbar@': {
                        template: __webpack_require__(8)
                    }
                },
                resolve: {
                  'AdminAppData': ["AdminApp", function (AdminApp) {
                    // This makes the controller wait until the initial config has been loaded
                    return InitPromise;
                  }]
                }
            })

I just added the webpack config like this:

var production = {

  module: {
    rules: [
      {
        test: /\.js$/,
        use: [
          {
            loader: 'ng-annotate-loader',
            options: {
              add: true,
              map: false,
            }
          }
        ]
      }
    ]
  },
...

hope it helps